function ListMail() {
	ModuleBase.call(this);
	var __this = this;
	this.popMenu = new EmMenu();
	this.folderId = "";
	this.__thisName = "";
	this.page = 0;
	this.sortStr = "";
	this.filterType = "all";
	this.resid = false;
	this.selCount = 0;
	this.selSize = 0;
	this.__menuId = "";
	this.__mailList = {};
	this.openCount = 0;
	this.lastOpenTime = 0;
	this.listMailRowValue = {
		from_digest : 1,
		subject_digest : 1,
		content_digest : 1,
		folder : 0,
		size : 0,
		index_time : 1
	};
	this.tdWidth = {
		from_digest : 150,
		index_time : 75,
		size : 55,
		folder : 60
	};
	this.trSelWidth = 102;
	this.tdAttachWidth = 35;
	this.tdTaskWidth = 35;
	this.tdSendWidth = 15;
	this.__folderIdArray = [];
	this.swfSettings = {};
	this.uploadSettings = {};
	this.uploadObject = null;
	this.dragObject = null;
	this.images = [];
	this.previewMailHeader = null;
	this.unreadMail = [];
	this.userPackMail = {};
	this.taskTopMail = {};
	this.curPageMailSize = {};
	this.webColorObj = {
		0 : "",
		1 : "color_hong",
		2 : "color_lv",
		3 : "color_cheng",
		4 : "color_lan",
		5 : "color_fen",
		6 : "color_qing",
		7 : "color_huang",
		8 : "color_zi",
		9 : "color_hui"
	};
	this.remarksPopWindow = null;
	this.lastReadMailIndex = "";
	this.importHasSuccess = false;
	this.modifyLocation = function(folderId, page, sortStr) {
		var dataUrlObj = this.dataUrlObj;
		if (false === dataUrlObj) {
			gMessage.showMessageMain(L("display the list mail fail")
					+ gCheck.getRestrictMessage({
						type : "paramError"
					}), "fail");
			return false
		}
		if ("" !== folderId && undefined !== folderId) {
			dataUrlObj.addReplaceParam("fid", folderId)
		}
		if ("" !== page && undefined !== page) {
			dataUrlObj.addReplaceParam("page", page)
		}
		if ("" !== sortStr && undefined !== sortStr) {
			dataUrlObj.addReplaceParam("sort", sortStr)
		}
		return dataUrlObj.getUrl()
	};
	this.loadPage = function() {
		var url = D(this.__moduleId).listmail;
		if (typeof (url) === "object") {
			url = url.getUrl()
		} else {
			if (url.substr(0, 1) !== "?") {
				url = "?" + url
			}
		}
		var urlObj = new UrlControl();
		urlObj.setUrl(url);
		this.folderId = urlObj.getParam("fid");
		if (this.folderId === "searchform") {
			__this.initSearch();
			$("#search_toolbar" + __this.__moduleExt).show();
			$("#closebar" + __this.__moduleExt).hide();
			$("#mail_list_toolbar" + __this.__moduleExt).hide();
			$("#search" + __this.__moduleExt).show();
			$("#mail_list" + __this.__moduleExt).hide();
			gModule.setTopMenu(__this.__menuId, {
				title : L("search email")
			});
			__this.setMainSize();
			return
		}
		if (this.folderId === "search") {
			__this.initSearch();
			$("#search_toolbar" + __this.__moduleExt).hide();
			$("#closebar" + __this.__moduleExt).show();
			$("#mail_list_toolbar" + __this.__moduleExt).show();
			$("#search" + __this.__moduleExt).hide();
			$("#mail_list" + __this.__moduleExt).show();
			this.searchFormStatus("open")
		} else {
			$("#search_toolbar" + __this.__moduleExt).hide();
			$("#closebar" + __this.__moduleExt).hide();
			$("#mail_list_toolbar" + __this.__moduleExt).show();
			$("#search" + __this.__moduleExt).hide();
			$("#mail_list" + __this.__moduleExt).show()
		}
		this.sortStr = urlObj.getParam("sort");
		if (false === this.sortStr) {
			urlObj.addReplaceParam("sort", "time.1");
			this.sortStr = "time.1.sender.0.subject.0.size.0"
		} else {
			var sortFieldArray = this.sortStr.split(".");
			var sortField = "";
			if (sortFieldArray.length > 1) {
				sortField = sortFieldArray[0] + "." + sortFieldArray[1]
			}
			urlObj.addReplaceParam("sort", sortField)
		}
		__this.resid = urlObj.getParam("resid");
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(L("display the list mail fail")
					+ gCheck.getRestrictMessage({
						type : "dataError",
						name : "listmail"
					}), "fail")
		}
		this.dataUrlObj = urlObj;
		gModule.getData({
			dataKey : {
				listmail : urlObj
			},
			fromType : "cache",
			dataType : "data",
			success : __this.__loadPage,
			error : processError
		})
	};
	this.__loadPage = function(jsonData) {
		__this.selCount = 0;
		__this.selSize = 0;
		if (jsonData._login == 0) {
			gMessage.hideMessageTop();
			alert(gCheck.getRestrictMessage({
				type : "notLogin"
			}));
			gModule.logout();
			gCc.cleanCache({
				q : "listmail",
				uc : __this.dataUrlObj
			});
			return
		}
		var data = jsonData.listmail;
		if (data === undefined || data.res === 0) {
			if (typeof (data.error) !== "undefined" && data.error != "") {
				gMessage.showMessageMain(data.error, "fail")
			} else {
				gMessage.showMessageMain(L("display the list mail fail")
						+ gCheck.getRestrictMessage({
							type : "dataError",
							name : "listmail"
						}), "fail")
			}
			gCc.cleanCache({
				q : "listmail",
				uc : __this.dataUrlObj
			});
			return
		}
		var pageData = data.data;
		var page = pageData.currpg;
		__this.page = pageData.currpg;
		var sort = __this.sortStr;
		var folderId = __this.folderId + "";
		__this.filterType = pageData.filter;
		__this.userPackMail = pageData.user_pack_mail;
		var mailListTop = pageData.maillist_top;
		var totalMailCount = getCount(pageData.maillist);
		var oldLastReadMail = gLastReadMailIndex;
		var oldTopReadMail = gTopReadMailIndex;
		__this.lastReadMailIndex = gLastReadMailIndex;
		var displayMarkSpam = pageData.display_mark_spam;
		var displaySpamFolder = pageData.display_spam_folder;
		var folderList = gFc.getFolderList();
		if (3 != pageData.show_all
				&& typeof (folderList[pageData.curfolderid]) === "undefined") {
			alert(L("current folder info error, this folder may be deleted."));
			return false
		}
		__this.show_all = pageData.show_all;
		var boxName = "";
		if (1 === pageData.show_all) {
			boxName = L("unread email")
		} else {
			if (2 === pageData.show_all) {
				boxName = L("all the draft")
			} else {
				if (3 === pageData.show_all) {
					boxName = L("search result")
				} else {
					boxName = folderList[pageData.curfolderid].fname
				}
			}
		}
		var subBox;
		switch (__this.filterType) {
		case "unread":
			subBox = '<b class="f14">' + L("unread email") + "</b>";
			g("box" + __this.__moduleExt).innerHTML = '<a href="javascript:enjoy();" onclick="O(\''
					+ __this.__moduleId
					+ '\').filterMail();" style="color:#2E85D6;">'
					+ htmlSpecialChars(boxName) + "</a> >> " + subBox;
			if (pageData.mail_unread_index.length > 0) {
				g("hassetunread" + __this.__moduleExt).style.display = ""
			} else {
				g("hassetunread" + __this.__moduleExt).style.display = "none"
			}
			g("hasunread" + __this.__moduleExt).style.display = "none";
			g("hastask" + __this.__moduleExt).style.display = "none";
			break;
		case "read":
			subBox = '<b class="f14">' + L("readed email") + "</b>";
			g("box" + __this.__moduleExt).innerHTML = '<a href="javascript:enjoy();" onclick="O(\''
					+ __this.__moduleId
					+ '\').filterMail();" style="color:#2E85D6;">'
					+ htmlSpecialChars(boxName) + "</a> >> " + subBox;
			g("hassetunread" + __this.__moduleExt).style.display = "none";
			g("hasunread" + __this.__moduleExt).style.display = "none";
			g("hastask" + __this.__moduleExt).style.display = "none";
			break;
		case "reply":
			subBox = '<b class="f14">' + L("already reply") + "</b>";
			g("box" + __this.__moduleExt).innerHTML = '<a href="javascript:enjoy();" onclick="O(\''
					+ __this.__moduleId
					+ '\').filterMail();" style="color:#2E85D6;">'
					+ htmlSpecialChars(boxName) + "</a> >> " + subBox;
			g("hassetunread" + __this.__moduleExt).style.display = "none";
			g("hasunread" + __this.__moduleExt).style.display = "none";
			g("hastask" + __this.__moduleExt).style.display = "none";
			break;
		case "forward":
			subBox = '<b class="f14">' + L("already forword") + "</b>";
			g("box" + __this.__moduleExt).innerHTML = '<a href="javascript:enjoy();" onclick="O(\''
					+ __this.__moduleId
					+ '\').filterMail();" style="color:#2E85D6;">'
					+ htmlSpecialChars(boxName) + "</a> >> " + subBox;
			g("hassetunread" + __this.__moduleExt).style.display = "none";
			g("hasunread" + __this.__moduleExt).style.display = "none";
			g("hastask" + __this.__moduleExt).style.display = "none";
			break;
		case "task":
			subBox = '<b class="f14">' + L("task email") + "</b>";
			g("box" + __this.__moduleExt).innerHTML = '<a href="javascript:enjoy();" onclick="O(\''
					+ __this.__moduleId
					+ '\').filterMail();" style="color:#2E85D6;">'
					+ htmlSpecialChars(boxName) + "</a> >> " + subBox;
			g("hasunread" + __this.__moduleExt).style.display = "none";
			g("hassetunread" + __this.__moduleExt).style.display = "none";
			g("hastask" + __this.__moduleExt).style.display = "none";
			break;
		default:
			g("box" + __this.__moduleExt).innerHTML = '<b class="f14">'
					+ htmlSpecialChars(boxName) + "</b>";
			if (pageData.mail_unread_index.length > 0) {
				g("hassetunread" + __this.__moduleExt).style.display = ""
			} else {
				g("hassetunread" + __this.__moduleExt).style.display = "none"
			}
			g("hasunread" + __this.__moduleExt).style.display = "";
			break
		}
		__this.unreadMail = pageData.mail_unread_index;
		g("count5" + __this.__moduleExt).innerHTML = pageData.total_num;
		g("count6" + __this.__moduleExt).innerHTML = pageData.total_unread_mail;
		g("count7" + __this.__moduleExt).innerHTML = pageData.total_task_mail;
		if (folderId != gFidTime && pageData.show_all == 0) {
			__this.initImportMail(pageData.rcpt_size, boxName)
		} else {
			if (pageData.show_all !== 3) {
				$("#listmail_others_btn" + __this.__moduleExt).hide()
			}
		}
		gModule.setTopMenu(__this.__menuId, {
			title : boxName
		});
		if (gFidTrash == pageData.curfolderid) {
			$("#del_btn1" + __this.__moduleExt).hide()
		}
		if (gFidTime == pageData.curfolderid) {
			$("#forward_selmail" + __this.__moduleExt).parent().hide();
			$("#moveto" + __this.__moduleExt).hide();
			$("#del_btn1" + __this.__moduleExt).hide();
			$("#forward" + __this.__moduleExt).hide()
		}
		var po = new Pager();
		po.setOptions({
			funLink : __this.__thisName + ".goPage",
			funJump : __this.__thisName + ".jumpPage",
			numPage : pageData.allpg,
			currentPage : pageData.currpg
		});
		var pagehtml1 = '<p class="f_L">'
				+ sprintf(L("the total page is %s"), po.getPage());
		var pagehtml2 = pagehtml1;
		pagehtml1 += "&nbsp;" + po.getJump(1 + __this.__moduleExt) + "</p>";
		pagehtml2 += "&nbsp;" + po.getJump(2 + __this.__moduleExt) + "</p>";
		pagehtml1 += po.getLink();
		pagehtml2 += po.getLink();
		g("page1" + __this.__moduleExt).innerHTML = pagehtml1;
		g("page2" + __this.__moduleExt).innerHTML = pagehtml2;
		if (pageData.list_mail_columns.length == 0) {
			for ( var p in __this.listMailRowValue) {
				__this.listMailRowValue[p] = 1
			}
		} else {
			for ( var p in __this.listMailRowValue) {
				__this.listMailRowValue[p] = 0
			}
			var curCol;
			for ( var i = 0, l = pageData.list_mail_columns.length; i < l; i++) {
				curCol = pageData.list_mail_columns[i];
				if (typeof __this.listMailRowValue[curCol] !== "undefined") {
					__this.listMailRowValue[curCol] = 1
				}
			}
		}
		var colCount = __this.getColCount();
		var sortFieldArray = sort.split(".");
		var sortName;
		var sortOrder;
		var sortClass = "";
		var sortItem = [ "sender", "time", "subject", "size" ];
		var sortClassSpan = {};
		if (sortFieldArray.length > 1) {
			sortName = sortFieldArray[0];
			sortOrder = sortFieldArray[1];
			if (sortOrder === "0") {
				sortClass = '<b class="arr_up"></b>'
			} else {
				sortClass = '<b class="arr_down"></b>'
			}
			var tmpLength = sortItem.length;
			for ( var p = 0; p < tmpLength; p++) {
				if (sortName == sortItem[p]) {
					sortClassSpan[sortItem[p]] = sortClass
				} else {
					sortClassSpan[sortItem[p]] = ""
				}
			}
		}
		$("#listmail_mark_btn" + __this.__moduleExt).css("display", "none");
		$("#listmail_unmark_btn" + __this.__moduleExt).css("display", "none");
		if (displayMarkSpam == 1 && pageData.curfolderid != gFidTime) {
			if (pageData.curfolderid != gFidSpam
					&& pageData.curfolderid != gFidTrash) {
				$("#listmail_mark_btn" + __this.__moduleExt).css("display", "");
				$("#listmail_unmark_btn" + __this.__moduleExt).css("display",
						"none")
			} else {
				if (displaySpamFolder == 1) {
					if (pageData.curfolderid == gFidSpam) {
						$("#listmail_mark_btn" + __this.__moduleExt).css(
								"display", "none");
						$("#listmail_unmark_btn" + __this.__moduleExt).css(
								"display", "")
					} else {
						if (pageData.curfolderid == gFidTrash) {
							$("#listmail_mark_btn" + __this.__moduleExt).css(
									"display", "");
							$("#listmail_unmark_btn" + __this.__moduleExt).css(
									"display", "none")
						}
					}
				} else {
					if (pageData.curfolderid == gFidTrash) {
						$("#listmail_mark_btn" + __this.__moduleExt).css(
								"display", "none");
						$("#listmail_unmark_btn" + __this.__moduleExt).css(
								"display", "")
					}
				}
			}
		}
		var mailFrom, mailWho;
		if (pageData.curfolderid == gFidDraft
				|| pageData.curfolderid == gFidSent || 2 === pageData.show_all
				|| pageData.curfolderid == gFidTime) {
			mailFrom = "<strong>" + L("the receiver") + "</strong>";
			mailWho = L("the receiver")
		} else {
			mailFrom = "<strong>" + L("the sender") + "</strong>";
			mailWho = L("the sender")
		}
		mailFrom = '<a href="javascript:enjoy();">' + mailFrom
				+ sortClassSpan.sender + "</a>";
		var tbNode = g("accept_list" + __this.__moduleExt);
		var tbodyNode, trNode, tdNode;
		tbodyNode = document.createElement("tbody");
		tbodyNode.id = "list_header" + __this.__moduleExt;
		tbNode.appendChild(tbodyNode);
		trNode = tbodyNode.insertRow(-1);
		trNode.className = "t_head";
		tdNode = trNode.insertCell(-1);
		if (__this.folderId != gFidTime) {
			tdNode.innerHTML = [
					'<a style="background: none repeat scroll 0% 0% transparent; cursor: default;" class="movetd"></a><input id="sall'
							+ __this.__moduleExt
							+ '" type="checkbox"  style="margin-top:5px;margin-top:3px\9;" class="left"><b title="'
							+ L("choose the rows to display by yourself")
							+ '" class="aandd posi left">', "</b>" ].join("")
		} else {
			tdNode.innerHTML = [
					'<input id="sall'
							+ __this.__moduleExt
							+ '" type="checkbox"  style="margin-top:5px;margin-top:3px\9;" class="left"><b title="'
							+ L("choose the rows to display by yourself")
							+ '" class="aandd posi left">', "</b>" ].join("")
		}
		tdNode.width = __this.trSelWidth;
		tdNode.style.borderRight = "none";
		var sAllCheck = tdNode.getElementsByTagName("INPUT")[0];
		$(sAllCheck).click(function() {
			this.checked ? __this.selectAll() : __this.selectNone()
		});
		__this.popMenu.bind(tdNode.getElementsByTagName("B")[0], "click", {
			dockElem : tdNode,
			strict : false,
			appendTo : g(__this.__moduleId),
			cssLink : gCssUrl + "menu_" + gStyle + ".css?v=" + gVersion,
			items : [],
			minWidth : 80,
			beforeShow : function(ev, thisMenu) {
				thisMenu.emptyItem();
				var cnt = 0;
				var checkedKey = "";
				var dis = {};
				var captions = {
					from_digest : mailWho,
					index_time : L("date"),
					subject_digest : L("email topic"),
					content_digest : L("content digest"),
					folder : L("email position"),
					size : L("email size"),
					preview : L("preview email")
				};
				for ( var k in __this.listMailRowValue) {
					if (__this.listMailRowValue[k]) {
						checkedKey = k;
						cnt++
					}
					dis[k] = false
				}
				if (cnt === 1) {
					dis[checkedKey] = true
				}
				var i = 0;
				for ( var k in __this.listMailRowValue) {
					thisMenu.setItem(-1, {
						caption : captions[k],
						isChecked : !!__this.listMailRowValue[k],
						click : __this.getListMailRow,
						params : [ k ],
						isDisabled : dis[k]
					})
				}
			}
		});
		if (__this.folderId == gFidSent) {
			tdNode = trNode.insertCell(-1);
			tdNode.width = __this.tdSendWidth;
			tdNode.style.borderLeft = "none";
			tdNode.style.borderRight = "none";
			tdNode.style.paddingRight = "0px"
		}
		if (__this.listMailRowValue.from_digest == 1) {
			tdNode = trNode.insertCell(-1);
			tdNode.innerHTML = mailFrom;
			tdNode.width = __this.tdWidth.from_digest;
			tdNode.style.borderRight = "none";
			tdNode.style.cursor = "pointer";
			tdNode.title = L("click it to sort");
			if (document.all) {
				tdNode.attachEvent("onclick", (function(s, t, p) {
					return function() {
						__this.sort(s, t, p)
					}
				})(sort, "sender", page))
			} else {
				tdNode.addEventListener("click", (function(s, t, p) {
					return function() {
						__this.sort(s, t, p)
					}
				})(sort, "sender", page), false)
			}
		}
		tdNode = trNode.insertCell(-1);
		tdNode.width = __this.tdTaskWidth;
		tdNode.style.borderLeft = "none";
		tdNode.style.paddingRight = "0px";
		if (__this.listMailRowValue.from_digest == 1) {
			tdNode.style.cursor = "pointer";
			tdNode.title = L("click it to sort");
			if (document.all) {
				tdNode.attachEvent("onclick", (function(s, t, p) {
					return function() {
						__this.sort(s, t, p)
					}
				})(sort, "sender", page))
			} else {
				tdNode.addEventListener("click", (function(s, t, p) {
					return function() {
						__this.sort(s, t, p)
					}
				})(sort, "sender", page), false)
			}
		}
		if (__this.listMailRowValue.subject_digest == 1
				|| __this.listMailRowValue.content_digest == 1) {
			tdNode = trNode.insertCell(-1);
			tdNode.innerHTML = (__this.listMailRowValue.subject_digest == 1 ? L("email topic")
					: L("content digest"))
		}
		tdNode = trNode.insertCell(-1);
		tdNode.width = __this.tdAttachWidth;
		tdNode.innerHTML = '<b class="enclosure"><b/>';
		if (__this.listMailRowValue.folder == 1 || 3 === pageData.show_all) {
			tdNode = trNode.insertCell(-1);
			tdNode.innerHTML = L("email position");
			tdNode.width = __this.tdWidth.folder
		}
		if (__this.listMailRowValue.size == 1) {
			tdNode = trNode.insertCell(-1);
			tdNode.innerHTML = '<a href="javascript:enjoy();"><strong>'
					+ L("email size") + "</strong>" + sortClassSpan.size
					+ "</a></td>";
			tdNode.width = __this.tdWidth.size;
			tdNode.style.cursor = "pointer";
			tdNode.title = L("click it to sort");
			if (document.all) {
				tdNode.attachEvent("onclick", (function(s, t, p) {
					return function() {
						__this.sort(s, t, p)
					}
				})(sort, "size", page))
			} else {
				tdNode.addEventListener("click", (function(s, t, p) {
					return function() {
						__this.sort(s, t, p)
					}
				})(sort, "size", page), false)
			}
		}
		if (__this.listMailRowValue.index_time == 1) {
			tdNode = trNode.insertCell(-1);
			tdNode.innerHTML = '<a href="javascript:enjoy();"><strong>'
					+ L("date") + "</strong>" + sortClassSpan.time + "</a>";
			tdNode.width = __this.tdWidth.index_time;
			tdNode.style.cursor = "pointer";
			tdNode.title = L("click it to sort");
			if (document.all) {
				tdNode.attachEvent("onclick", (function(s, t, p) {
					return function() {
						__this.sort(s, t, p)
					}
				})(sort, "time", page))
			} else {
				tdNode.addEventListener("click", (function(s, t, p) {
					return function() {
						__this.sort(s, t, p)
					}
				})(sort, "time", page), false)
			}
		}
		if (folderId == gFidTrash || folderId == gFidSpam) {
			var autoDelTime = (pageData.curfolderid == gFidTrash ? pageData.trash_clear_time
					: pageData.spam_clear_time);
			trNode = tbodyNode.insertRow(-1);
			tdNode = trNode.insertCell(-1);
			tdNode.colSpan = colCount;
			tdNode.align = "center";
			tdNode.style.color = "#ff0000";
			switch (autoDelTime) {
			case "1":
				tdNode.innerHTML = sprintf(
						L("mail in %s will be deleted after logout"), boxName);
				break;
			case "10":
				tdNode.innerHTML = sprintf(
						L("mail in %s will be deleted after %s day"), boxName,
						7);
				break;
			case "11":
				tdNode.innerHTML = sprintf(
						L("mail in %s will be deleted after %s day"), boxName,
						14);
				break;
			case "12":
			default:
				tdNode.innerHTML = sprintf(
						L("mail in %s will be deleted after %s day"), boxName,
						30);
				break
			}
		}
		var actionType;
		if (1 === pageData.show_all) {
			actionType = "readmail.unread"
		} else {
			if (2 === pageData.show_all) {
				actionType = "readmail.draft"
			} else {
				if (3 === pageData.show_all) {
					actionType = "readmail.search"
				} else {
					actionType = "readmail"
				}
			}
		}
		__this.actionType = actionType;
		var sortFieldArray = __this.sortStr.split(".");
		var sortField = "";
		if (sortFieldArray.length > 1) {
			sortField = sortFieldArray[0] + "." + sortFieldArray[1]
		}
		__this.sortField = sortField;
		var iconClass, iconClass2, thisSender, thisSubject, thisSubject2, thisIndexId, isChecked, thisIsRead, thisIsDraft, thisIsFwd, thisIsReply, thisMailTime, thisFolderName, thisSize, thisData, thisTdClass, thisAttach;
		var selIndex = gIndex.getIndex([ "listmail", __this.folderId,
				__this.filterType ]);
		__this.now = pageData.now;
		var nowTime = __this.now;
		var tmpLength = pageData.maillist.length;
		var dayMap = gModule.sortMailAsDate;
		var dDay;
		var findme;
		var curMap = "";
		var lastMap = "";
		var dayMapIndex = {};
		if (__this.folderId != gFidTime) {
			__this.dragObject = new dragAndDrop();
			__this.dragObject
					.init({
						container : document,
						target : function() {
							var folderDrop = [];
							folderList = gFc.getFolderList();
							for ( var p in folderList) {
								if (p == gFidTime || p == __this.folderId) {
									continue
								}
								folderDrop.push(g("fia_" + p))
							}
							return folderDrop
						},
						mouseAt : {
							left : 26,
							top : 10
						},
						helper : function(node) {
							if (g("drag_div")) {
								$("#drag_div").remove()
							}
							var _node = document.createElement("div");
							_node.id = "drag_div";
							_node.className = "move";
							var _indexId = gIndex.getIndex([ "listmail",
									__this.folderId, __this.filterType ]);
							var _topIndexId = gIndex.getIndex([ "listmail",
									__this.folderId, "tasktop" ]);
							var indexId = [];
							for ( var p in _indexId) {
								indexId.push(p)
							}
							for ( var k in _topIndexId) {
								indexId.push(k)
							}
							if (!node.childNodes[2].checked) {
								var tNode = node.childNodes[2];
								var tvalue = tNode.value;
								var tId = tNode.id;
								if (tId.indexOf("top") == -1) {
									var lv = tvalue + "_"
											+ __this.curPageMailSize[tvalue];
									indexId.push(lv);
									node.childNodes[2].checked = true;
									__this
											.checkboxBlur(node.childNodes[2].value)
								} else {
									var lv = tvalue + "_"
											+ __this.curPageMailSize[tvalue];
									indexId.push(lv);
									node.childNodes[2].checked = true;
									__this
											.topCheckboxBlur(node.childNodes[2].value)
								}
							}
							var cnt;
							if (indexId.length === 1) {
								cnt = L("email topic:") + '"'
										+ htmlSpecialChars(node.title) + '"'
							} else {
								cnt = sprintf(L("you selected %s letters"),
										indexId.length)
							}
							_node.setAttribute("data", indexId.join(","));
							_node.innerHTML = '<span class="error"></span>'
									+ cnt;
							document.body.appendChild(_node);
							return _node
						},
						dropOver : function(ev, tf, draged) {
							tf.className = "MailMoveHere";
							draged.childNodes[0].className = "suc"
						},
						dropOut : function(ev, tf, draged) {
							tf.className = "";
							draged.childNodes[0].className = "error"
						},
						dragRange : function(o, n, item) {
							var x = n[0];
							var y = n[1];
							var X = document.body.offsetWidth
									+ (document.documentElement.scrollLeft === 0 ? document.body.scrollLeft
											: document.documentElement.scrollLeft)
									- item.offsetWidth;
							var Y = document.body.offsetHeight
									+ (document.documentElement.scrollTop === 0 ? document.body.scrollTop
											: document.documentElement.scrollTop)
									- item.offsetHeight;
							if (x <= 0) {
								x = 0
							} else {
								if (x >= X) {
									x = X
								}
							}
							if (y <= 0) {
								y = 0
							} else {
								if (y >= Y) {
									y = Y
								}
							}
							return [ x, y ]
						},
						dropDown : function(ev, tf, draged) {
							var fid = tf.id.substr(4);
							if (fid == __this.folderId || fid == gFidTime
									|| __this.folderId == gFidTime) {
								return
							}
							var indexId = draged.getAttribute("data");
							__this.dragMail(indexId.split(","), fid)
						}
					})
		}
		var dragHTML;
		var thisSender2;
		var fList = [];
		var thisFolder;
		for ( var p in folderList) {
			if (p == gFidTime || __this.folderId == p) {
				continue
			}
			thisFolder = folderList[p];
			eval("var tmp=function(){__this.moveMail(" + p + ");};");
			fList.push({
				title : thisFolder.fname,
				click : tmp,
				caption : thisFolder.fname
			})
		}
		__this.popMenu.bind(g("moveto" + __this.__moduleExt), "click", {
			dockElem : g("moveto" + __this.__moduleExt),
			strict : false,
			appendTo : g(__this.__moduleId),
			cssLink : gCssUrl + "menu_" + gStyle + ".css?v=" + gVersion,
			items : fList
		});
		__this.popMenu.bind(g("view_btn" + __this.__moduleExt), "click", {
			dockElem : g("view_btn" + __this.__moduleExt),
			strict : true,
			appendTo : g(__this.__moduleId),
			cssLink : gCssUrl + "menu_" + gStyle + ".css?v=" + gVersion,
			items : [ {
				caption : L("all"),
				click : function() {
					__this.filterMail()
				},
				isChecked : __this.filterType === "all"
			}, {
				caption : L("unread email"),
				click : function() {
					__this.filterMail("unread")
				},
				isChecked : __this.filterType === "unread"
			}, {
				caption : L("readed email"),
				click : function() {
					__this.filterMail("read")
				},
				isChecked : __this.filterType === "read"
			}, {
				caption : L("already reply"),
				click : function() {
					__this.filterMail("reply")
				},
				isChecked : __this.filterType === "reply"
			}, {
				caption : L("already forword"),
				click : function() {
					__this.filterMail("forward")
				},
				isChecked : __this.filterType === "forward"
			}, {
				caption : L("task email"),
				click : function() {
					__this.filterMail("task")
				},
				isChecked : __this.filterType === "task"
			} ]
		});
		__this.popMenu.bind(g("sign_as_btn" + __this.__moduleExt), "click", {
			dockElem : g("sign_as_btn" + __this.__moduleExt),
			strict : true,
			appendTo : g(__this.__moduleId),
			cssLink : gCssUrl + "menu_" + gStyle + ".css?v=" + gVersion,
			items : [
					{
						caption : L("readed email"),
						click : function() {
							__this.changeMailStatus("unread2read")
						}
					},
					{
						caption : L("unread email"),
						click : function() {
							__this.changeMailStatus("read2unread")
						}
					},
					"separator",
					{
						caption : L("task email"),
						click : function() {
							__this.changeMailStatus("task")
						}
					},
					{
						caption : L("untask email"),
						click : function() {
							__this.changeMailStatus("untask")
						}
					},
					"separator",
					{
						caption : '<span style="color:#000;">' + L("black")
								+ "<span>",
						click : function() {
							__this.colorMail(0)
						}
					},
					{
						caption : '<span style="color:#f00;">' + L("red")
								+ "<span>",
						click : function() {
							__this.colorMail(1)
						}
					},
					{
						caption : '<span style="color:#0c0;">' + L("green")
								+ "<span>",
						click : function() {
							__this.colorMail(2)
						}
					},
					{
						caption : '<span style="color:#f90;"">' + L("orange")
								+ "<span>",
						click : function() {
							__this.colorMail(3)
						}
					},
					{
						caption : '<span style="color:#009;">' + L("blue")
								+ "<span>",
						click : function() {
							__this.colorMail(4)
						}
					},
					{
						caption : '<span style="color:#FF00A2;">' + L("pink")
								+ "<span>",
						click : function() {
							__this.colorMail(5)
						}
					},
					{
						caption : '<span style="color:#00AEEF;">' + L("cyan")
								+ "<span>",
						click : function() {
							__this.colorMail(6)
						}
					},
					{
						caption : '<span style="color:#EFCB06;">' + L("yellow")
								+ "<span>",
						click : function() {
							__this.colorMail(7)
						}
					},
					{
						caption : '<span style="color:#CC00CC;">' + L("purple")
								+ "<span>",
						click : function() {
							__this.colorMail(8)
						}
					},
					{
						caption : '<span style="color:#666666;">' + L("gray")
								+ "<span>",
						click : function() {
							__this.colorMail(9)
						}
					} ]
		});
		if (!gSupportFlash || gUploadType == 1) {
			__this.uploadObject = new EmUpload(__this.uploadSettings);
			var elm = __this.uploadObject.getElement();
			var importItem = {
				caption : L("importing mails"),
				click : function() {
				},
				mousemove : function(m, e) {
					var pos = getPosition(g("listmail_others_btn"
							+ __this.__moduleExt));
					elm.style.left = pos[0] + e.clientX - 20 + "px";
					elm.style.top = pos[1]
							+ g("listmail_others_btn" + __this.__moduleExt).offsetHeight
							+ e.clientY - 10 + "px"
				}
			}
		} else {
			var importItem = {
				caption : L("importing mails"),
				click : function() {
					__this.registeSwfUplod()
				}
			}
		}
		var itemsArr = [];
		if (pageData.show_all !== 3) {
			itemsArr.push(importItem)
		}
		itemsArr.push({
			caption : L("exporting mails"),
			click : function() {
				__this.exportMail()
			}
		});
		__this.popMenu
				.bind(g("listmail_others_btn" + __this.__moduleExt), "click",
						{
							dockElem : g("listmail_others_btn"
									+ __this.__moduleExt),
							strict : true,
							appendTo : g(__this.__moduleId),
							cssLink : gCssUrl + "menu_" + gStyle + ".css?v="
									+ gVersion,
							items : itemsArr
						});
		$(document).bind(
				"skinChange",
				function(ev, th, sk) {
					__this.popMenu.changeCss(gCssUrl + "menu_" + sk[1]
							+ ".css?v=" + gVersion)
				});
		__this.setMainSize();
		if (mailListTop.length > 0) {
			__this.drawTaskTopMail(mailListTop, pageData)
		}
		function fillData(_page) {
			try {
				var per = 10;
				var limit = (_page - 1) * per;
				var offset = (limit + per >= tmpLength ? tmpLength : limit
						+ per);
				for ( var p = limit; p < offset; p++) {
					thisData = pageData.maillist[p];
					thisIsRead = thisData.is_read;
					thisIsDraft = thisData.is_draft;
					thisIsFwd = thisData.is_fwd;
					thisIsReply = thisData.is_reply;
					thisIndexId = thisData.mail_id;
					thisSubject = thisData.subject_digest ? thisData.subject_digest
							: L("no topic");
					thisSubject2 = htmlSpecialChars(thisSubject);
					thisTask = thisData.is_task;
					thisWebColor = thisData.web_color;
					thisRemarksCon = thisData.remarks_content;
					thisRemarksTime = thisData.remarks_time;
					__this.__mailList[thisIndexId] = thisData;
					thisRcptNum = thisData.rcpt_num - 0;
					thisRcptSuccessNum = thisData.rcpt_success_num - 0;
					thisRcptFailNum = thisData.rcpt_fail_num - 0;
					thisDeliverType = thisData.deliver_type - 0;
					if (pageData.curfolderid == gFidDraft
							|| pageData.curfolderid == gFidSent
							|| 2 === pageData.show_all
							|| pageData.curfolderid == gFidTime) {
						thisSender = thisData.to_display;
						thisSender2 = thisData.to_digest
					} else {
						thisSender = thisData.from_display;
						thisSender2 = thisData.from_digest
					}
					thisSender = htmlSpecialChars(thisSender);
					thisMailTime = thisData.index_time;
					thisSize = thisData.size;
					if (typeof (__this.curPageMailSize[thisIndexId]) == "undefined") {
						__this.curPageMailSize[thisIndexId] = thisSize
					}
					if (sortName === "time") {
						dDay = Math.ceil((nowTime - thisMailTime)
								/ (60 * 60 * 24));
						findme = false;
						for (curMap in dayMap) {
							if (dDay <= dayMap[curMap]) {
								findme = true;
								break
							}
						}
						if (false === findme) {
							curMap = "lastest"
						}
						if (!dayMapIndex[curMap]) {
							if (lastMap !== "") {
								g("sortMailTotalNumber_" + lastMap
										+ __this.__moduleExt).innerHTML = L(lastMap)
										+ '(<a style="color:#0000FF" onclick="'
										+ __this.__thisName
										+ ".selSortMail('period_tbody_"
										+ lastMap
										+ __this.__moduleExt
										+ '\');" href="javascript:enjoy();">'
										+ dayMapIndex[lastMap]
										+ L("envelop")
										+ "</a>)"
							}
							tbodyNode = document.createElement("tbody");
							tbodyNode.id = "preiod_inbox_head_" + curMap
									+ __this.__moduleExt;
							tbNode.appendChild(tbodyNode);
							trNode = tbodyNode.insertRow(-1);
							trNode.className = "divbg";
							tdNode = trNode.insertCell(-1);
							tdNode.colSpan = colCount;
							tdNode.innerHTML = '<div id="InboxDate'
									+ __this.__moduleExt
									+ '"><b title="'
									+ L("fold")
									+ '" class="side_open" onclick="'
									+ __this.__thisName
									+ ".disSortMail(this, 'period_tbody_"
									+ curMap
									+ __this.__moduleExt
									+ '\', \'date\');" name="7"></b><div id="sortMailTotalNumber_'
									+ curMap + __this.__moduleExt
									+ '" style="float:left;"></div></div>';
							tbodyNode = document.createElement("tbody");
							tbodyNode.id = "period_tbody_" + curMap
									+ __this.__moduleExt;
							tbNode.appendChild(tbodyNode);
							dayMapIndex[curMap] = 1
						} else {
							dayMapIndex[curMap]++;
							tbodyNode = g("period_tbody_" + curMap
									+ __this.__moduleExt)
						}
						lastMap = curMap
					} else {
						if (g("period_tbody_" + sortName + __this.__moduleExt)) {
							tbodyNode = g("period_tbody_" + sortName
									+ __this.__moduleExt)
						} else {
							if (mailListTop.length > 0) {
								tbodyNode = document.createElement("tbody");
								tbodyNode.id = "preiod_inbox_head_" + sortName
										+ __this.__moduleExt;
								tbNode.appendChild(tbodyNode);
								trNode = tbodyNode.insertRow(-1);
								trNode.className = "divbg";
								tdNode = trNode.insertCell(-1);
								tdNode.colSpan = colCount;
								tdNode.innerHTML = '<div id="InboxDate_'
										+ sortName
										+ __this.__moduleExt
										+ '"><b title="'
										+ L("fold")
										+ '" class="side_open" onclick="'
										+ __this.__thisName
										+ ".disSortMail(this, 'period_tbody_"
										+ sortName
										+ __this.__moduleExt
										+ '\', \'date\');" name="7"></b><div id="sortMailTotalNumber_'
										+ sortName
										+ __this.__moduleExt
										+ '" style="float:left;">(<a style="color:#0000FF" onclick="'
										+ __this.__thisName
										+ ".selSortMail('period_tbody_"
										+ sortName + __this.__moduleExt
										+ '\');" href="javascript:enjoy();">'
										+ totalMailCount + L("envelop")
										+ "</a>)</div></div>"
							}
							tbodyNode = document.createElement("tbody");
							tbodyNode.id = "period_tbody_" + sortName
									+ __this.__moduleExt;
							tbNode.appendChild(tbodyNode)
						}
					}
					if (thisIsDraft == 1) {
						iconClass = '<b class="sketch left" title="'
								+ L("draft") + '"></b>'
					} else {
						if (thisIsRead == 0) {
							iconClass = '<b class="mailnoread left" title="'
									+ L("unread email") + '"></b>'
						} else {
							if (thisIsFwd == 1 && thisIsReply == 1) {
								iconClass = '<b class="mailrep_fwd left" title="'
										+ L("already reply and forword")
										+ '"></b>'
							} else {
								if (thisIsFwd == 1) {
									iconClass = '<b class="mailfwd left" title="'
											+ L("already forword") + '"></b>'
								} else {
									if (thisIsReply == 1) {
										iconClass = '<b class="mailrep left" title="'
												+ L("already reply") + '"></b>'
									} else {
										iconClass = ""
									}
								}
							}
						}
					}
					switch (parseInt(thisData.priority)) {
					case 1:
						iconClass2 = '<b class="grade_1 left" title="'
								+ L("priority highest") + '"></b>';
						break;
					case 2:
						iconClass2 = '<b class="grade_3 left" title="'
								+ L("priority higher") + '"></b>';
						break;
					case 4:
						iconClass2 = '<b class="grade_2 left" title="'
								+ L("priority lower") + '"></b>';
						break;
					case 5:
						iconClass2 = '<b class="grade_4 left" title="'
								+ L("priority lowest") + '"></b>';
						break;
					default:
						iconClass2 = ""
					}
					if (gFidTime == pageData.curfolderid) {
						iconClass = '<b class="timesend left" title="'
								+ L("the Timemail") + '"></b>'
					}
					if ((thisData.media_type - 0) & 1) {
						thisAttach = '<b class="ivoice"></b>'
					} else {
						if ((thisData.media_type - 0) & 2) {
							thisAttach = '<b class="ivideo"></b>'
						} else {
							if (thisData.has_attach != 0) {
								thisAttach = '<b class="enclosure"></b>'
							} else {
								thisAttach = ""
							}
						}
					}
					for (k in selIndex) {
						var tmpSel = k.split("_");
						if (tmpSel[0] == thisIndexId) {
							isChecked = " checked";
							__this.selCount++;
							__this.selSize += thisSize - 0;
							break
						} else {
							isChecked = ""
						}
					}
					if (thisIsRead == 1) {
						thisTdClass = ""
					} else {
						thisTdClass = " noread"
					}
					if (isChecked) {
						thisTdClass = thisTdClass ? thisTdClass + " bgcolor2"
								: " bgcolor2"
					}
					if (thisTask == 1) {
						thisTaskClass = '<b class="daiban right" onclick="'
								+ __this.__thisName
								+ ".changeMailStatus('untask', '" + thisIndexId
								+ '\');" title="' + L("untask email")
								+ '"></b>'
					} else {
						thisTaskClass = ""
					}
					var tmpContent = "";
					thisRemarksClass = (thisRemarksCon == "" ? ""
							: '<b class="beizhu right" title="'
									+ L("click to show remarks")
									+ '" id="remarks_' + thisIndexId + '"></b>');
					if (__this.listMailRowValue.content_digest != 1) {
						tmpContent = ""
					} else {
						var tc = (thisRemarksCon !== "" ? L("remark:")
								+ htmlSpecialChars(thisRemarksCon) + " -- <i>"
								+ formatDate(__this.now, thisRemarksTime)
								+ "</i>"
								: htmlSpecialChars(thisData.content_digest));
						tmpContent = ' <span style="color:#aaaaaa;">' + tc
								+ "</span>"
					}
					var tmpWebColor = (typeof (__this.webColorObj[thisWebColor]) == "undefined" ? ""
							: __this.webColorObj[thisWebColor]);
					var tsub = '<span class="' + tmpWebColor + '">'
							+ thisSubject2 + "</span>";
					var lastMailContent = (__this.listMailRowValue.subject_digest != 1 ? ""
							: tsub)
							+ tmpContent;
					thisFolderName = folderList[thisData.folder_id].fname;
					trNode = tbodyNode.insertRow(-1);
					trNode.className = "drag_tr" + thisTdClass;
					eval("trNode.onmouseover = function() {"
							+ __this.__thisName
							+ ".trMouseOver("
							+ thisIndexId
							+ ", this);};trNode.onmouseout = function() {"
							+ __this.__thisName
							+ ".trMouseOut("
							+ thisIndexId
							+ ", this);};trNode.onclick = function(event) {event = (event == null)?window.event:event;"
							+ __this.__thisName + ".selectInput(event,"
							+ thisIndexId + ", this);};");
					trNode.id = "tr_" + thisIndexId + __this.__moduleExt;
					tdNode = trNode.insertCell(-1);
					if (oldLastReadMail == thisIndexId
							&& !g("last_read_" + thisIndexId)
							&& oldLastReadMail != oldTopReadMail) {
						var lastReadHtml = '<b id="last_read_' + thisIndexId
								+ '" title="' + L("lastest read mail")
								+ '" class="hasread"></b>'
					} else {
						var lastReadHtml = ""
					}
					if (__this.dragObject) {
						dragHTML = '<a class="movetd"></a>'
					} else {
						dragHTML = ""
					}
					tdNode.innerHTML = [
							'<div id="hasread_div_'
									+ thisIndexId
									+ '" class="posi">'
									+ lastReadHtml
									+ dragHTML
									+ '</div><input type="hidden" name="STATUS[]" value="',
							thisIsRead,
							'" id="',
							thisIndexId,
							"_STATUS" + __this.__moduleExt,
							'"><input name="MSG[]" class="left" type="checkbox" value="',
							thisIndexId,
							'"',
							isChecked,
							' onblur="'
									+ __this.__thisName
									+ ".checkboxBlur('"
									+ thisIndexId
									+ '\');" onclick="javascript:this.focus();this.blur();" id="'
									+ thisIndexId + __this.__moduleExt + '"',
							"/>",
							'<b class="mail_close" style="float:left;" id="dopre'
									+ __this.__moduleExt + '" title="',
							L("unfold preview"), '" onclick ="',
							__this.__thisName, '.previewMail(this)" onblur="',
							__this.__thisName, ".checkboxBlur('", thisIndexId,
							'\');" name="', thisIndexId, '"></b>',
							iconClass2 + iconClass ].join("");
					tdNode.id = "data_title_" + thisIndexId;
					tdNode.className = "movetd_input";
					tdNode.title = thisSubject;
					if (__this.dragObject) {
						__this.dragObject.setDragable(tdNode,
								tdNode.childNodes[0])
					}
					if (pageData.curfolderid == gFidSent) {
						tdNode = trNode.insertCell(-1);
						tdNode.style.paddingRight = "0px";
						var sendClass = "";
						var sendTitle = "";
						var sendTotalNum = thisRcptSuccessNum + thisRcptFailNum;
						if (thisRcptSuccessNum == thisRcptNum) {
							sendClass = "send_1";
							sendTitle = L("send message success")
						} else {
							if (sendTotalNum < thisRcptNum) {
								sendClass = "send_3";
								sendTitle = L("sending message")
							} else {
								if ((sendTotalNum == thisRcptNum)
										&& thisRcptFailNum > 0) {
									sendClass = "send_2";
									sendTitle = L("send message fail")
								}
							}
						}
						if (thisDeliverType == 10 || thisDeliverType == 11) {
							tdNode.innerHTML = '<b title="' + sendTitle
									+ '" class="' + sendClass + '"></b>'
						} else {
							tdNode.innerHTML = ""
						}
					}
					if (__this.listMailRowValue.from_digest == 1) {
						tdNode = trNode.insertCell(-1);
						tdNode.innerHTML = [
								'<a href="javascript:enjoy();" onclick="',
								__this.__thisName, ".readMail('", thisIndexId,
								"','", actionType, "', '", sortField, "',",
								thisIsRead, ');">', thisSender, "</a>" ]
								.join("");
						tdNode.title = thisSender2
					}
					tdNode = trNode.insertCell(-1);
					tdNode.style.paddingRight = "0px";
					tdNode.innerHTML = thisRemarksClass + thisTaskClass;
					if (__this.listMailRowValue.subject_digest == 1
							|| __this.listMailRowValue.content_digest == 1) {
						tdNode = trNode.insertCell(-1);
						tdNode.innerHTML = [ '<a title="', thisSubject2,
								'" href="javascript:enjoy();" onclick="',
								__this.__thisName, ".readMail('", thisIndexId,
								"','", actionType, "', '", sortField, "',",
								thisIsRead, ');">', lastMailContent, "</a>" ]
								.join("")
					}
					tdNode = trNode.insertCell(-1);
					tdNode.innerHTML = thisAttach;
					if (__this.listMailRowValue.folder == 1
							|| 3 === pageData.show_all) {
						tdNode = trNode.insertCell(-1);
						tdNode.innerHTML = thisFolderName
					}
					if (__this.listMailRowValue.size == 1) {
						tdNode = trNode.insertCell(-1);
						tdNode.innerHTML = [ '<span class="f_L">',
								formatBytes(thisSize, 0), "</span>" ].join("")
					}
					if (__this.listMailRowValue.index_time == 1) {
						tdNode = trNode.insertCell(-1);
						tdNode.innerHTML = formatDate(pageData.now,
								thisMailTime);
						tdNode.title = toDate(L("year month day and hour"),
								thisMailTime)
					}
					if (g("remarks_" + thisIndexId)) {
						var obj = g("remarks_" + thisIndexId);
						if (document.all) {
							obj.attachEvent("onclick", (function(c, t, o) {
								return function() {
									__this.showRemarksPop(c, t, o)
								}
							})(thisRemarksCon, thisRemarksTime, obj))
						} else {
							obj.addEventListener("click", (function(c, t, o) {
								return function() {
									__this.showRemarksPop(c, t, o)
								}
							})(thisRemarksCon, thisRemarksTime, obj), false)
						}
					}
				}
				if (offset < tmpLength) {
					_setTimeout(fillData, 0, _page + 1)
				} else {
					_setTimeout(fillOther, 0)
				}
			} catch (e) {
			}
		}
		function fillOther() {
			try {
				if (sortName === "time" && curMap !== "") {
					g("sortMailTotalNumber_" + curMap + __this.__moduleExt).innerHTML = L(curMap)
							+ '(<a style="color:#0000FF" onclick="'
							+ __this.__thisName
							+ ".selSortMail('period_tbody_"
							+ curMap
							+ __this.__moduleExt
							+ '\');" href="javascript:enjoy();">'
							+ dayMapIndex[curMap] + L("envelop") + "</a>)"
				}
				__this.htmlSetCount();
				if (pageData.search_info !== undefined) {
					if (pageData.search_info.words !== undefined
							&& pageData.search_info.words.length > 0) {
						highLight(pageData.search_info.words, $(
								"#accept_list" + __this.__moduleExt).find(
								".drag_tr > td > a"))
					}
					if (pageData.search_info.form !== undefined) {
						__this.fillSearchForm(pageData.search_info.form);
						__this.setKeywordInfo()
					}
				}
			} catch (e) {
			}
		}
		_setTimeout(fillData, 0, 1);
		return
	};
	this.drawTaskTopMail = function(topMailData, pageData) {
		var topLen = topMailData.length;
		var colCount = __this.getColCount();
		var selIndex = gIndex
				.getIndex([ "listmail", __this.folderId, "tasktop" ]);
		var tbNode = g("accept_list" + __this.__moduleExt);
		var folderList = gFc.getFolderList();
		var isChecked;
		var _oldLastReadMail = gLastReadMailIndex;
		var _oldTopReadMail = gTopReadMailIndex;
		__this.lastReadMailIndex = gLastReadMailIndex;
		var actionType;
		if (1 === pageData.show_all) {
			actionType = "readmail.unread"
		} else {
			if (2 === pageData.show_all) {
				actionType = "readmail.draft"
			} else {
				if (3 === pageData.show_all) {
					actionType = "readmail.search"
				} else {
					actionType = "readmail"
				}
			}
		}
		__this.actionType = actionType;
		var sortFieldArray = __this.sortStr.split(".");
		var sortField = "";
		if (sortFieldArray.length > 1) {
			sortField = sortFieldArray[0] + "." + sortFieldArray[1]
		}
		__this.sortField = sortField;
		tbodyNode = document.createElement("tbody");
		tbodyNode.id = "preiod_inbox_head_top" + __this.__moduleExt;
		tbNode.appendChild(tbodyNode);
		trNode = tbodyNode.insertRow(-1);
		trNode.className = "divbg";
		tdNode = trNode.insertCell(-1);
		tdNode.colSpan = colCount - 2;
		tdNode.innerHTML = '<div id="InboxDate_top'
				+ __this.__moduleExt
				+ '"><b title="'
				+ L("fold")
				+ '" class="side_open" onclick="'
				+ __this.__thisName
				+ ".disSortMail(this, 'period_tbody_top"
				+ __this.__moduleExt
				+ '\', \'date\');" name="7"></b><div id="sortMailTotalNumber_top'
				+ __this.__moduleExt + '" style="float:left;">'
				+ L("task mail top") + '(<a style="color:#0000FF" onclick="'
				+ __this.__thisName + ".selSortMail('period_tbody_top"
				+ __this.__moduleExt
				+ "', 'top');\" href=\"javascript:enjoy();\">" + topLen
				+ L("envelop") + "</a>)</div></div>";
		tdNode = trNode.insertCell(-1);
		tdNode.colSpan = "2";
		tdNode.style.textAlign = "right";
		tdNode.style.paddingRight = "20px";
		tdNode.innerHTML = '<a href="javascript:enjoy();" style="color:#0000ff;" onclick="'
				+ __this.__thisName
				+ '.cancelTaskTop();">'
				+ L("cancel task top") + "</a>";
		tbodyNode = document.createElement("tbody");
		tbodyNode.id = "period_tbody_top" + __this.__moduleExt;
		tbNode.appendChild(tbodyNode);
		for ( var p = 0; p < topLen; p++) {
			thisData = topMailData[p];
			thisIsRead = thisData.is_read;
			thisIsDraft = thisData.is_draft;
			thisIsFwd = thisData.is_fwd;
			thisIsReply = thisData.is_reply;
			thisIndexId = thisData.mail_id;
			thisSubject = thisData.subject_digest ? thisData.subject_digest
					: L("no topic");
			thisSubject2 = htmlSpecialChars(thisSubject);
			thisTask = thisData.is_task;
			thisWebColor = thisData.web_color;
			thisRemarksCon = thisData.remarks_content;
			thisRemarksTime = thisData.remarks_time;
			__this.taskTopMail[thisIndexId] = thisData;
			thisRcptNum = thisData.rcpt_num - 0;
			thisRcptSuccessNum = thisData.rcpt_success_num - 0;
			thisRcptFailNum = thisData.rcpt_fail_num - 0;
			thisDeliverType = thisData.deliver_type - 0;
			if (pageData.curfolderid == gFidDraft
					|| pageData.curfolderid == gFidSent
					|| 2 === pageData.show_all
					|| pageData.curfolderid == gFidTime) {
				thisSender = thisData.to_display;
				thisSender2 = thisData.to_digest
			} else {
				thisSender = thisData.from_display;
				thisSender2 = thisData.from_digest
			}
			thisSender = htmlSpecialChars(thisSender);
			thisMailTime = thisData.index_time;
			thisSize = thisData.size;
			if (typeof (__this.curPageMailSize[thisIndexId]) == "undefined") {
				__this.curPageMailSize[thisIndexId] = thisSize
			}
			if (thisIsDraft == 1) {
				iconClass = '<b class="sketch left" title="' + L("draft")
						+ '"></b>'
			} else {
				if (thisIsRead == 0) {
					iconClass = '<b class="mailnoread left" title="'
							+ L("unread email") + '"></b>'
				} else {
					if (thisIsFwd == 1 && thisIsReply == 1) {
						iconClass = '<b class="mailrep_fwd left" title="'
								+ L("already reply and forword") + '"></b>'
					} else {
						if (thisIsFwd == 1) {
							iconClass = '<b class="mailfwd left" title="'
									+ L("already forword") + '"></b>'
						} else {
							if (thisIsReply == 1) {
								iconClass = '<b class="mailrep left" title="'
										+ L("already reply") + '"></b>'
							} else {
								iconClass = ""
							}
						}
					}
				}
			}
			switch (parseInt(thisData.priority)) {
			case 1:
				iconClass2 = '<b class="grade_1 left" title="'
						+ L("priority highest") + '"></b>';
				break;
			case 2:
				iconClass2 = '<b class="grade_3 left" title="'
						+ L("priority higher") + '"></b>';
				break;
			case 4:
				iconClass2 = '<b class="grade_2 left" title="'
						+ L("priority lower") + '"></b>';
				break;
			case 5:
				iconClass2 = '<b class="grade_4 left" title="'
						+ L("priority lowest") + '"></b>';
				break;
			default:
				iconClass2 = ""
			}
			if (gFidTime == pageData.curfolderid) {
				iconClass = '<b class="timesend left" title="'
						+ L("the Timemail") + '"></b>'
			}
			if ((thisData.media_type - 0) & 1) {
				thisAttach = '<b class="ivoice"></b>'
			} else {
				if ((thisData.media_type - 0) & 2) {
					thisAttach = '<b class="ivideo"></b>'
				} else {
					if (thisData.has_attach != 0) {
						thisAttach = '<b class="enclosure"></b>'
					} else {
						thisAttach = ""
					}
				}
			}
			for (k in selIndex) {
				var tmpSel = k.split("_");
				if (tmpSel[0] == thisIndexId) {
					isChecked = " checked";
					__this.selCount++;
					__this.selSize += thisSize - 0;
					break
				} else {
					isChecked = ""
				}
			}
			if (thisIsRead == 1) {
				thisTdClass = ""
			} else {
				thisTdClass = " noread"
			}
			if (isChecked) {
				thisTdClass = thisTdClass ? thisTdClass + " bgcolor2"
						: " bgcolor2"
			}
			if (thisTask == 1) {
				thisTaskClass = '<b class="daiban right" onclick="'
						+ __this.__thisName + ".changeMailStatus('untask', '"
						+ thisIndexId + '\');" title="' + L("untask email")
						+ '"></b>'
			} else {
				thisTaskClass = ""
			}
			var tmpContent = "";
			thisRemarksClass = (thisRemarksCon == "" ? ""
					: '<b class="beizhu right" title="'
							+ L("click to show remarks") + '" id="remarks_top_'
							+ thisIndexId + '"></b>');
			if (__this.listMailRowValue.content_digest != 1) {
				tmpContent = ""
			} else {
				var tc = (thisRemarksCon !== "" ? L("remark:")
						+ htmlSpecialChars(thisRemarksCon) + " -- <i>"
						+ formatDate(__this.now, thisRemarksTime) + "</i>"
						: htmlSpecialChars(thisData.content_digest));
				tmpContent = ' <span style="color:#aaaaaa;">' + tc + "</span>"
			}
			var tmpWebColor = (typeof (__this.webColorObj[thisWebColor]) == "undefined" ? ""
					: __this.webColorObj[thisWebColor]);
			var tsub = '<span class="' + tmpWebColor + '">' + thisSubject2
					+ "</span>";
			var lastMailContent = (__this.listMailRowValue.subject_digest != 1 ? ""
					: tsub)
					+ tmpContent;
			thisFolderName = folderList[thisData.folder_id].fname;
			trNode = tbodyNode.insertRow(-1);
			trNode.className = "drag_tr" + thisTdClass;
			eval("trNode.onmouseover = function() {"
					+ __this.__thisName
					+ ".trMouseOver("
					+ thisIndexId
					+ ", this);};trNode.onmouseout = function() {"
					+ __this.__thisName
					+ ".trMouseOut("
					+ thisIndexId
					+ ", this);};trNode.onclick = function(event) {event = (event == null)?window.event:event;"
					+ __this.__thisName + ".selectInput(event," + thisIndexId
					+ ", this);};");
			trNode.id = "tr_top_" + thisIndexId + __this.__moduleExt;
			tdNode = trNode.insertCell(-1);
			if (_oldLastReadMail == thisIndexId
					&& !g("last_read_" + thisIndexId)
					&& _oldLastReadMail == _oldTopReadMail) {
				var lastReadHtml = '<b title="' + L("lastest read mail")
						+ '" id="last_read_' + thisIndexId
						+ '" class="hasread"></b>'
			} else {
				var lastReadHtml = ""
			}
			if (__this.dragObject) {
				dragHTML = '<a class="movetd"></a>'
			} else {
				dragHTML = ""
			}
			tdNode.innerHTML = [
					'<div id="hasread_div_top_'
							+ thisIndexId
							+ '" class="posi">'
							+ lastReadHtml
							+ dragHTML
							+ '</div><input type="hidden" name="STATUS[]" value="',
					thisIsRead,
					'" id="',
					thisIndexId,
					"_STATUS_TOP" + __this.__moduleExt,
					'"><input name="MSG[]" class="left" type="checkbox" value="',
					thisIndexId,
					'"',
					isChecked,
					' onblur="'
							+ __this.__thisName
							+ ".topCheckboxBlur('"
							+ thisIndexId
							+ '\');" onclick="javascript:this.focus();this.blur();" id="'
							+ thisIndexId + "_top" + __this.__moduleExt + '"',
					"/>",
					'<b class="mail_close" style="float:left;" id="dopre_top'
							+ __this.__moduleExt + '" title="',
					L("unfold preview"), '" onclick ="', __this.__thisName,
					'.previewMail(this)" onblur="', __this.__thisName,
					".topCheckboxBlur('", thisIndexId, '\');" name="',
					thisIndexId, '"></b>', iconClass2 + iconClass ].join("");
			tdNode.id = "data_title_top_" + thisIndexId;
			tdNode.className = "movetd_input";
			tdNode.title = thisSubject;
			if (__this.dragObject) {
				__this.dragObject.setDragable(tdNode, tdNode.childNodes[0])
			}
			if (pageData.curfolderid == gFidSent) {
				tdNode = trNode.insertCell(-1);
				tdNode.style.paddingRight = "0px";
				var sendClass = "";
				var sendTitle = "";
				var sendTotalNum = thisRcptSuccessNum + thisRcptFailNum;
				if (thisRcptSuccessNum == thisRcptNum) {
					sendClass = "send_1";
					sendTitle = L("send message success")
				} else {
					if (sendTotalNum < thisRcptNum) {
						sendClass = "send_3";
						sendTitle = L("sending message")
					} else {
						if ((sendTotalNum == thisRcptNum)
								&& thisRcptFailNum > 0) {
							sendClass = "send_2";
							sendTitle = L("send message fail")
						}
					}
				}
				if (thisDeliverType == 10 || thisDeliverType == 11) {
					tdNode.innerHTML = '<b title="' + sendTitle + '" class="'
							+ sendClass + '"></b>'
				} else {
					tdNode.innerHTML = ""
				}
			}
			if (__this.listMailRowValue.from_digest == 1) {
				tdNode = trNode.insertCell(-1);
				tdNode.innerHTML = [ '<a href="javascript:enjoy();" onclick="',
						__this.__thisName, ".readMail('", thisIndexId, "','",
						actionType, "', '", sortField, "',", thisIsRead,
						', true);">', thisSender, "</a>" ].join("");
				tdNode.title = thisSender2
			}
			tdNode = trNode.insertCell(-1);
			tdNode.innerHTML = thisRemarksClass + thisTaskClass;
			tdNode.style.paddingRight = "0px";
			if (__this.listMailRowValue.subject_digest == 1
					|| __this.listMailRowValue.content_digest == 1) {
				tdNode = trNode.insertCell(-1);
				tdNode.innerHTML = [ '<a title="', thisSubject2,
						'" href="javascript:enjoy();" onclick="',
						__this.__thisName, ".readMail('", thisIndexId, "','",
						actionType, "', '", sortField, "',", thisIsRead,
						', true);">', lastMailContent, "</a>" ].join("")
			}
			tdNode = trNode.insertCell(-1);
			tdNode.innerHTML = thisAttach;
			if (__this.listMailRowValue.folder == 1 || 3 === pageData.show_all) {
				tdNode = trNode.insertCell(-1);
				tdNode.innerHTML = thisFolderName
			}
			if (__this.listMailRowValue.size == 1) {
				tdNode = trNode.insertCell(-1);
				tdNode.innerHTML = [ '<span class="f_L">',
						formatBytes(thisSize, 0), "</span>" ].join("")
			}
			if (__this.listMailRowValue.index_time == 1) {
				tdNode = trNode.insertCell(-1);
				tdNode.innerHTML = formatDate(pageData.now, thisMailTime);
				tdNode.title = toDate(L("year month day and hour"),
						thisMailTime)
			}
			if (g("remarks_top_" + thisIndexId)) {
				var obj = g("remarks_top_" + thisIndexId);
				if (document.all) {
					obj.attachEvent("onclick", (function(c, t, o) {
						return function() {
							__this.showRemarksPop(c, t, o)
						}
					})(thisRemarksCon, thisRemarksTime, obj))
				} else {
					obj.addEventListener("click", (function(c, t, o) {
						return function() {
							__this.showRemarksPop(c, t, o)
						}
					})(thisRemarksCon, thisRemarksTime, obj), false)
				}
			}
		}
	};
	this.cancelTaskTop = function() {
		if (!confirm(L("be sure to cancel task top? \nafter canceled, you can open it in mail settings"))) {
			return false
		}
		$.ajax({
			url : gUrlPrefix + "?q=settings.web.do",
			type : "post",
			data : "action=untop&is_top_taskmail=0",
			dataType : "json",
			error : function() {
				gMessage.showMessageMain(L("cancel task top fail")
						+ L("system error, please try again later"), "fail");
				return false
			},
			success : function(msg) {
				$(".status").html("");
				if (msg._login == 0) {
					alert(gCheck.getRestrictMessage({
						type : "notLogin"
					}));
					gModule.logout();
					return false
				}
				if (1 == msg.res) {
					gMessage.showMessageMain(L("cancel task top success"),
							"success");
					var uc = new UrlControl();
					gCc.cleanCache({
						q : "settings_web",
						uc : uc,
						type : "page"
					});
					gCc.cleanCache({
						q : "listmail",
						uc : uc,
						type : "page"
					});
					__this.goPage(1)
				} else {
					gMessage.showMessageMain(L("cancel task top fail")
							+ msg.error, "fail");
					return false
				}
			}
		});
		return false
	};
	this.getColCount = function() {
		var cnt = (__this.folderId == gFidSent ? 4 : 3);
		var hasSubject = false, hasContent = false;
		for ( var p in __this.listMailRowValue) {
			if (__this.listMailRowValue[p]) {
				if (p === "subject_digest") {
					hasSubject = true
				}
				if (p === "content_digest") {
					hasContent = true
				}
				cnt++
			}
		}
		if (hasContent && hasSubject) {
			cnt--
		}
		return cnt
	};
	this.getLineStyle = function(thisData) {
		var iconClass, iconClass2, thisIndexId, thisIsRead, thisIsDraft, thisIsFwd, thisIsReply;
		thisIsRead = thisData.is_read;
		thisIsDraft = thisData.is_draft;
		thisIsFwd = thisData.is_fwd;
		thisIsReply = thisData.is_reply;
		thisIndexId = thisData.mail_id;
		if (thisIsDraft == 1) {
			iconClass = '<b class="sketch left" title="' + L("draft")
					+ '"></b>'
		} else {
			if (thisIsRead == 0) {
				iconClass = '<b class="mailnoread left" title="'
						+ L("unread email") + '"></b>'
			} else {
				if (thisIsFwd == 1 && thisIsReply == 1) {
					iconClass = '<b class="mailrep_fwd left" title="'
							+ L("already reply and forword") + '"></b>'
				} else {
					if (thisIsFwd == 1) {
						iconClass = '<b class="mailfwd left" title="'
								+ L("already forword") + '"></b>'
					} else {
						if (thisIsReply == 1) {
							iconClass = '<b class="mailrep left" title="'
									+ L("already reply") + '"></b>'
						} else {
							iconClass = ""
						}
					}
				}
			}
		}
		switch (parseInt(thisData.priority)) {
		case 1:
			iconClass2 = '<b class="grade_1 left" title="'
					+ L("priority highest") + '"></b>';
			break;
		case 2:
			iconClass2 = '<b class="grade_3 left" title="'
					+ L("priority higher") + '"></b>';
			break;
		case 4:
			iconClass2 = '<b class="grade_2 left" title="'
					+ L("priority lower") + '"></b>';
			break;
		case 5:
			iconClass2 = '<b class="grade_4 left" title="'
					+ L("priority lowest") + '"></b>';
			break;
		default:
			iconClass2 = ""
		}
		return iconClass + iconClass2
	};
	this.previewMail = function(element, fid) {
		if (element.disabled === true) {
			return false
		}
		var indexId = $(element.parentNode.parentNode).find("input:checkbox")
				.val();
		if ("undefined" !== typeof (fid)) {
			if (indexId.indexOf("_") !== -1) {
				indexId = indexId.substr(0, indexId.indexOf("_"))
			}
		}
		if ($(element).attr("class") == "mail_close") {
			$(element).attr("class", "mail_open");
			$(element).attr("title", L("fold preview"));
			element.disabled = true;
			gMessage.showMessageTop();
			$
					.ajax({
						url : gUrlPrefix + "?q=compose.preview",
						data : "iid=" + indexId,
						type : "get",
						dataType : "json",
						success : function(mf) {
							gMessage.hideMessageTop();
							if ("undefined" !== typeof (fid)) {
								indexId += "_" + fid
							}
							if (mf._login !== 1) {
								alert(gCheck.getRestrictMessage({
									type : "notLogin"
								}));
								gModule.logout();
								return
							}
							if (mf.res == 0) {
								gMessage.showMessageMain(
										L("get the email message fail")
												+ gCheck.getRestrictMessage({
													type : "systemError"
												}), "fail");
								$(element).attr("class", "mail_close");
								$(element).attr("title", L("unfold preview"));
								element.disabled = false;
								if (element.id.indexOf("top") == -1) {
									$(
											"#preview_" + indexId
													+ __this.__moduleExt)
											.remove()
								} else {
									$(
											"#preview_top_" + indexId
													+ __this.__moduleExt)
											.remove()
								}
							}
							var data = mf.data;
							if ("undefined" !== typeof (fid)) {
								data.mail_id += "_" + fid
							}
							var html = "";
							__this.previewMailHeader = data.header_info;
							if (element.id.indexOf("_top") == -1) {
								var rowIndex = g("tr_" + data.mail_id
										+ __this.__moduleExt).sectionRowIndex;
								var tr = g("tr_" + data.mail_id
										+ __this.__moduleExt).parentNode
										.insertRow(rowIndex + 1);
								var preId = "preview_cont_" + indexId
										+ __this.__moduleExt;
								var opt = "main";
								var trId = "preview_" + data.mail_id
										+ __this.__moduleExt
							} else {
								var rowIndex = g("tr_top_" + data.mail_id
										+ __this.__moduleExt).sectionRowIndex;
								var tr = g("tr_top_" + data.mail_id
										+ __this.__moduleExt).parentNode
										.insertRow(rowIndex + 1);
								var preId = "preview_cont_top_" + indexId
										+ __this.__moduleExt;
								var opt = "top";
								var trId = "preview_top_" + data.mail_id
										+ __this.__moduleExt
							}
							tr.id = trId;
							tr.className = "no_w";
							var td = tr.insertCell(0);
							td.colSpan = __this.getColCount();
							td.innerHTML = '<div class="preview"><div class="preview_cont preview_cont_roll" id="'
									+ preId + '"></div></div>';
							var body = (data.mail_body_html !== "" ? __this
									.htmlView(data.mail_body_html,
											data.show_image, indexId, opt)
									: __this.textView(data.mail_body_text, opt));
							body = '<div id="mc' + data.mail_id
									+ __this.__moduleExt + '">' + body
									+ "</div>";
							var attachsHtml = "";
							var packDownHtml = "";
							if (data.attachs_info.length > 0) {
								var attachs = data.attachs_info;
								var attPart = [];
								var tmpLength = attachs.length;
								for ( var att = 0; att < tmpLength; att++) {
									var attMes = htmlSpecialChars(attachs[att].filename)
											+ " ("
											+ formatBytes(attachs[att].size, 0)
											+ ")";
									attachsHtml += '<li><em></em><a class="fjwidth" title="'
											+ attMes
											+ '" href="javascript:enjoy();" onclick="download(\''
											+ gUrlPublicPrefix
											+ "?q=compose.output&action=mail.attach&mid="
											+ data.mail_id
											+ "&part="
											+ attachs[att].part
											+ "&method=down&zid="
											+ gZid
											+ "');\">";
									attachsHtml += attMes;
									attachsHtml += "</a></li>";
									attPart.push(attachs[att].part)
								}
								if (attachs.length > 1) {
									packDownHtml = '<a style="color:#f60;" href="javascript:enjoy();" onclick="download(\''
											+ gUrlPublicPrefix
											+ "?q=compose.output&action=mail.attach.compress&mid="
											+ data.mail_id
											+ "&part="
											+ attPart.join(",")
											+ "&method=down&zid="
											+ gZid
											+ "');\">["
											+ L("download as a pack") + "]</a>"
								}
								body += '<div align=left style="padding-left:10px;"><h4 style="font-size:12px;">'
										+ L("attach")
										+ packDownHtml
										+ '</h4><ul class="fj_w fj_wleft">'
										+ attachsHtml + "</ul></div>"
							}
							g(preId).innerHTML = body;
							forceWrapNode(td);
							element.disabled = false;
							$("#mc" + data.mail_id + __this.__moduleExt + " a")
									.attr("target", "_blank");
							var p = parseInt($(element).attr("name"));
							if ((typeof (__this.__mailList[p]) !== "undefined" && __this.__mailList[p].is_read == 0)
									|| (typeof (__this.taskTopMail[p]) !== "undefined" && __this.taskTopMail[p].is_read == 0)) {
								if (__this.__mailList[p]) {
									__this.__mailList[p].is_read = 1;
									var styles = __this
											.getLineStyle(__this.__mailList[p])
								}
								if (__this.taskTopMail[p]) {
									__this.taskTopMail[p].is_read = 1;
									var styles = __this
											.getLineStyle(__this.taskTopMail[p])
								}
								if (g("tr_" + data.mail_id + __this.__moduleExt)
										&& "undefined" === typeof (fid)) {
									var pTr = g("tr_" + data.mail_id
											+ __this.__moduleExt);
									$(pTr.cells[0]).find("b").not(
											".mail_close, .mail_open").remove();
									$(pTr.cells[0]).append(styles);
									$(pTr).removeClass("noread")
								}
								if (g("tr_top_" + data.mail_id
										+ __this.__moduleExt)
										&& "undefined" === typeof (fid)) {
									var pTr = g("tr_top_" + data.mail_id
											+ __this.__moduleExt);
									$(pTr.cells[0]).find("b").not(
											".mail_close, .mail_open").remove();
									$(pTr.cells[0]).append(styles);
									$(pTr).removeClass("noread")
								}
								if (g(data.mail_id + "_STATUS"
										+ __this.__moduleExt)) {
									g(data.mail_id + "_STATUS"
											+ __this.__moduleExt).value = 1
								}
								if (g(data.mail_id + "_STATUS_TOP"
										+ __this.__moduleExt)) {
									g(data.mail_id + "_STATUS_TOP"
											+ __this.__moduleExt).value = 1
								}
								__this.mailStatusOnChange(true)
							}
							__this.openCount++;
							__this.lastOpenTime = (new Date()).getTime();
							if (element.id.indexOf("top") == -1) {
								__this.signLastReadMail("hasread_div_"
										+ indexId, indexId, 0)
							} else {
								__this.signLastReadMail("hasread_div_top_"
										+ indexId, indexId, 1)
							}
						},
						error : function() {
							if ("undefined" !== typeof (fid)) {
								indexId = indexId += "_" + fid
							}
							$(element).attr("class", "mail_close");
							$(element).attr("title", L("unfold preview"));
							element.disabled = false;
							if (element.id.indexOf("top") == -1) {
								$("#preview_" + indexId + __this.__moduleExt)
										.remove()
							} else {
								$(
										"#preview_top_" + indexId
												+ __this.__moduleExt).remove()
							}
							gMessage.hideMessageTop();
							gMessage.showMessageMain(
									L("get the email message fail")
											+ gCheck.getRestrictMessage({
												type : "systemError"
											}), "fail")
						}
					})
		} else {
			if ("undefined" !== typeof (fid)) {
				indexId = indexId += "_" + fid
			}
			if (element.id.indexOf("top") == -1) {
				$("#preview_" + indexId + __this.__moduleExt).remove()
			} else {
				$("#preview_top_" + indexId + __this.__moduleExt).remove()
			}
			$(element).attr("class", "mail_close");
			$(element).attr("title", L("unfold preview"));
			__this.openCount--
		}
	};
	this.viewConfig = function() {
		return [ "https", "ftp", "http" ]
	};
	this.htmlView = function(textContent, showImage, iid, opt) {
		textContent = linkAbleHtml(textContent);
		__this.images = [];
		if (!showImage) {
			var regImage = new RegExp(
					"(<[^>]*img\\s[^>]*src\\s*=\\s*)('|\")([^'\"]*)('|\")([^>]*>)",
					"ig");
			var res = textContent.replace(regImage, function($0, $1, $2, $3,
					$4, $5) {
				__this.images.push($3.replace(/\&amp;/g, "&"));
				return $1 + $2 + "javascript:void(0)" + $4 + $5
			})
		} else {
			var res = textContent
		}
		if (!showImage && __this.images.length > 0) {
			var divPrebar = document.createElement("DIV");
			divPrebar.className = "prebar";
			divPrebar.id = "image_control_" + iid + __this.__moduleExt;
			if (opt == "top") {
				var preObj = g("preview_cont_top_" + iid + __this.__moduleExt)
			} else {
				var preObj = g("preview_cont_" + iid + __this.__moduleExt)
			}
			var parentNode = preObj.parentNode;
			parentNode.insertBefore(divPrebar, preObj);
			divPrebar.innerHTML = L("in order to protect the mail security, images not shown in content.")
					+ '<a href="javascript:void(0);" onclick="O(\''
					+ __this.__moduleId
					+ "').showImages("
					+ iid
					+ ');">'
					+ L("show images")
					+ "</a> | "
					+ (showImage == 0 ? '<a href="javascript:void(0);" onclick="O(\''
							+ __this.__moduleId
							+ "').alwaysShowImage(true, "
							+ iid
							+ ');">'
							+ L("always trust images from this sender")
							+ "</a>"
							: '<a href="javascript:void(0);" onclick="O(\''
									+ __this.__moduleId
									+ "').alwaysShowImage(false, "
									+ iid
									+ ');">'
									+ L("cancel always trust images from this sender")
									+ "</a>")
		}
		return res
	};
	this.showImages = function(iid) {
		var imgs = g("mc" + iid + __this.__moduleExt).getElementsByTagName(
				"img");
		for ( var i = 0; i < imgs.length; i++) {
			imgs[i].src = (typeof (__this.images[i]) !== "undefined" ? __this.images[i]
					: "")
		}
		var div = g("image_control_" + iid + __this.__moduleExt);
		if (div) {
			$(div).remove()
		}
	};
	this.alwaysShowImage = function(flag, iid) {
		gHeader = __this.previewMailHeader;
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(errinfo, "fail")
		}
		if (typeof (gHeader._from) !== "undefined") {
			var oA = new MailRfc822();
			oA.setOptions({
				defaultDomain : gDomain
			});
			if (!oA.setAddress(gHeader._from)) {
				var e = oA.getError();
				alert(e[1]);
				return
			}
			var emails = oA.getAddressList();
			var email = emails[0].user + "@" + emails[0].domain
		} else {
			var email = ""
		}
		flag = flag ? 1 : 0;
		$
				.ajax({
					url : gUrlPrefix + "?q=compose.wmis",
					data : "email=" + encodeURIComponent(email) + "&flag="
							+ flag,
					dataType : "json",
					error : processError,
					type : "POST",
					success : function(o) {
						if (o._login !== 1) {
							__this.logout();
							return
						}
						if (o.res) {
							var divPrebar = g("image_control_" + iid
									+ __this.__moduleExt);
							divPrebar.innerHTML = L("in order to protect the mail security, images not shown in content.")
									+ '<a href="javascript:void(0);" onclick="O(\''
									+ __this.__moduleId
									+ "').showImages("
									+ iid
									+ ');">'
									+ L("show images")
									+ "</a> | "
									+ (flag == 0 ? '<a href="javascript:void(0);" onclick="O(\''
											+ __this.__moduleId
											+ "').alwaysShowImage(true, "
											+ iid
											+ ');">'
											+ L("always trust images from this sender")
											+ "</a>"
											: '<a href="javascript:void(0);" onclick="O(\''
													+ __this.__moduleId
													+ "').alwaysShowImage(false, "
													+ iid
													+ ');">'
													+ L("cancel always trust images from this sender")
													+ "</a>")
						} else {
							gMessage.showMessageMain(o.error, "fail")
						}
					}
				})
	};
	this.textView = function(textContent, opt) {
		var prefix = this.viewConfig();
		prefix = prefix.join("|");
		var reg = new RegExp("(" + prefix + "):\\/\\/[^<>\\s\\'\"]+", "ig");
		var tmp1 = [], tmp2 = [];
		var rand1 = "em1" + (new Date()).getTime();
		var rand2 = "em2" + (new Date()).getTime();
		textContent = textContent.replace(reg, function($0, $1) {
			tmp1.push($0);
			return rand1
		}).replace(new RegExp("[a-z0-9-_.]+@[a-z0-9-.]+[a-z]{2,4}", "ig"),
				function($0, $1) {
					tmp2.push($0);
					return rand2
				});
		textContent = htmlSpecialChars(textContent).replace(/(( )|((\r)?\n))/g,
				function($0, $1, $2, $3) {
					if ($2 === " ") {
						return "&nbsp;"
					}
					if ($3 !== "" && $3 !== undefined) {
						return "<br>"
					}
				});
		reg = new RegExp(rand1, "g");
		textContent = textContent.replace(reg, function($0, $1) {
			var url = tmp1.shift();
			return '<a href="' + url + '" target="_blank">' + url + "</a>"
		});
		reg = new RegExp(rand2, "g");
		return textContent.replace(reg, function($0, $1) {
			var url = tmp2.shift();
			return '<a href="mailto:' + url + '" target="_blank">' + url
					+ "</a>"
		})
	};
	this.checkboxBlur = function(iid) {
		__this._checkboxBlur(iid);
		__this.htmlSetCount()
	};
	this._checkboxBlur = function(iid) {
		var cl = "";
		var alreadyIn = false;
		if (g(iid + "_STATUS" + __this.__moduleExt)
				&& g(iid + "_STATUS" + __this.__moduleExt).value == 0) {
			cl = "noread"
		}
		var selIndex = gIndex.getIndex([ "listmail", __this.folderId,
				__this.filterType ]);
		var topIndex = gIndex
				.getIndex([ "listmail", __this.folderId, "tasktop" ]);
		for (k in selIndex) {
			var tmpSel = k.split("_");
			if (tmpSel[0] == iid) {
				alreadyIn = true;
				break
			}
		}
		var val = iid + "_" + __this.curPageMailSize[iid];
		if (g(iid + __this.__moduleExt) && g(iid + __this.__moduleExt).checked) {
			if (alreadyIn == false) {
				__this.selCount++;
				if (typeof (topIndex[val]) === "undefined") {
					__this.selSize += __this.curPageMailSize[iid] - 0
				}
			}
			gIndex.addIndex([ "listmail", __this.folderId, __this.filterType ],
					val);
			cl = cl ? cl + " bgcolor2" : "bgcolor2"
		} else {
			if (alreadyIn == true) {
				__this.selCount--;
				if (__this.selSize > 0
						&& (typeof (topIndex[val]) === "undefined")) {
					__this.selSize -= __this.curPageMailSize[iid] - 0
				}
			}
			gIndex.delIndex([ "listmail", __this.folderId, __this.filterType ],
					val);
			cl = cl ? cl : ""
		}
		if (g("tr_" + iid + __this.__moduleExt)) {
			$("#tr_" + iid + __this.__moduleExt).attr("class", cl)
		}
	};
	this.topCheckboxBlur = function(iid) {
		__this._topCheckboxBlur(iid);
		__this.htmlSetCount()
	};
	this._topCheckboxBlur = function(iid) {
		var cl = "";
		var alreadyIn = false;
		if (g(iid + "_STATUS_TOP" + __this.__moduleExt)
				&& g(iid + "_STATUS_TOP" + __this.__moduleExt).value == 0) {
			cl = "noread"
		}
		var topIndex = gIndex
				.getIndex([ "listmail", __this.folderId, "tasktop" ]);
		var mainIndex = gIndex.getIndex([ "listmail", __this.folderId,
				__this.filterType ]);
		for (k in topIndex) {
			var tmpSel = k.split("_");
			if (tmpSel[0] == iid) {
				alreadyIn = true;
				break
			}
		}
		var val = iid + "_" + __this.curPageMailSize[iid];
		if (g(iid + "_top" + __this.__moduleExt)
				&& g(iid + "_top" + __this.__moduleExt).checked) {
			if (alreadyIn == false) {
				__this.selCount++;
				if (typeof (mainIndex[val]) === "undefined") {
					__this.selSize += __this.curPageMailSize[iid] - 0
				}
			}
			gIndex.addIndex([ "listmail", __this.folderId, "tasktop" ], val);
			cl = cl ? cl + " bgcolor2" : "bgcolor2"
		} else {
			if (alreadyIn == true) {
				__this.selCount--;
				if (__this.selSize > 0
						&& (typeof (mainIndex[val]) === "undefined")) {
					__this.selSize -= __this.curPageMailSize[iid] - 0
				}
			}
			gIndex.delIndex([ "listmail", __this.folderId, "tasktop" ], val);
			cl = cl ? cl : ""
		}
		if (g("tr_top_" + iid + __this.__moduleExt)) {
			$("#tr_top_" + iid + __this.__moduleExt).attr("class", cl)
		}
	};
	this.showRemarksPop = function(con, time, obj) {
		if (!__this.remarksPopWindow) {
			return false
		}
		var oDoc = __this.remarksPopWindow.document;
		oDoc.innerHTML = "";
		oDoc.body.innerHTML = '<div class="main"><div class="arr"><div class="line1"></div><div class="line2"></div><div class="line3"></div><div class="line4"></div><div class="line5"></div><div class="line6"></div><div class="line7"></div></div><div class="outline"></div><div class="content"><div class="lpic"></div><div class="recont"><h3>'
				+ L("remarks message")
				+ "</h3><p>"
				+ nl2br(htmlSpecialChars(con))
				+ " -- <i>"
				+ formatDate(__this.now, time)
				+ '</i></p></div><div class="btnbar" style="display:none;"></div></div></div>';
		__this.remarksPopWindow.show(-32, 20, "auto", "auto", obj, true);
		return false
	};
	this.hideRemarksPop = function() {
		if (!__this.remarksPopWindow) {
			return false
		}
		var oDoc = __this.remarksPopWindow.document;
		oDoc.body.innerHTML = "";
		__this.remarksPopWindow.hide();
		return false
	};
	this.createPopWindow = function() {
		__this.remarksPopWindow = new PopWindow({
			pnode : g(__this.__moduleId),
			allowTransparency : true
		});
		var oDoc = __this.remarksPopWindow.document;
		var headNode = oDoc.getElementsByTagName("head")[0];
		var oldLink = oDoc.getElementById("remarks_link");
		if (oldLink) {
			headNode.removeClass(oldLink)
		}
		setTimeout(function() {
			var css = oDoc.createElement("link");
			css.type = "text/css";
			css.rel = "stylesheet";
			css.href = gCssUrl + "remarks.css?v=" + gVersion;
			css.id = "remarks_link";
			headNode.appendChild(css)
		}, 0)
	};
	this.trMouseOver = function(iid, obj) {
		var cl = "";
		if (obj.id.indexOf("_top") == -1) {
			var statusObj = g(iid + "_STATUS" + __this.__moduleExt)
		} else {
			var statusObj = g(iid + "_STATUS_TOP" + __this.__moduleExt)
		}
		var isread = statusObj.value;
		if (isread == 0) {
			cl = "noread"
		}
		cl = cl ? cl + " bgcolor" : "bgcolor";
		cl = cl ? cl + " drag_tr" : "drag_tr";
		obj.className = cl
	};
	this.trMouseOut = function(iid, obj) {
		var cl = "";
		if (obj.id.indexOf("_top") == -1) {
			var statusObj = g(iid + "_STATUS" + __this.__moduleExt);
			var inputObj = g(iid + __this.__moduleExt)
		} else {
			var statusObj = g(iid + "_STATUS_TOP" + __this.__moduleExt);
			var inputObj = g(iid + "_top" + __this.__moduleExt)
		}
		var isread = statusObj.value;
		if (isread == 0) {
			cl = "noread"
		}
		if (inputObj.checked) {
			cl = cl ? cl + " bgcolor2" : "bgcolor2"
		} else {
			cl = cl ? cl : ""
		}
		cl = cl ? cl + " drag_tr" : "drag_tr";
		obj.className = cl
	};
	this.selectAll = function() {
		$("#" + __this.__moduleId).find("input:checkbox").each(
				function(i) {
					if (this.name == "MSG[]") {
						this.checked = true;
						if (this.id.indexOf("top_" + __this.__moduleId) == -1) {
							__this._checkboxBlur(this.id.substr(0, this.id
									.indexOf(__this.__moduleId) - 1))
						} else {
							__this._topCheckboxBlur(this.id.substr(0, this.id
									.indexOf("top_" + __this.__moduleId) - 1))
						}
					}
				});
		g("sall" + __this.__moduleExt).checked = true;
		__this.htmlSetCount()
	};
	this.selectNone = function() {
		$("#" + __this.__moduleId).find("input:checkbox").each(
				function(i) {
					if (this.name == "MSG[]") {
						this.checked = false;
						if (this.id.indexOf("top_" + __this.__moduleId) == -1) {
							__this._checkboxBlur(this.id.substr(0, this.id
									.indexOf(__this.__moduleId) - 1))
						} else {
							__this._topCheckboxBlur(this.id.substr(0, this.id
									.indexOf("top_" + __this.__moduleId) - 1))
						}
					}
				});
		g("sall" + __this.__moduleExt).checked = false;
		__this.htmlSetCount()
	};
	this.selectUnread = function() {
		var tmpIndex;
		$("#" + __this.__moduleId).find("input:hidden").each(function(i) {
			tmpId = this.id.substring(0, this.id.indexOf("_STATUS"));
			if (this.name == "STATUS[]") {
				if (this.id.indexOf("_STATUS_TOP") == -1) {
					var inputObj = $("#" + tmpId + __this.__moduleExt)
				} else {
					var inputObj = $("#" + tmpId + "_top" + __this.__moduleExt)
				}
				if (this.value == 1) {
					inputObj.attr("checked", false)
				} else {
					inputObj.attr("checked", true)
				}
				if (this.id.indexOf("_STATUS_TOP") == -1) {
					__this._checkboxBlur(tmpId)
				} else {
					__this._topCheckboxBlur(tmpId)
				}
			}
		});
		__this.htmlSetCount()
	};
	this.selectRead = function() {
		var tmpIndex;
		$("#" + __this.__moduleId).find("input:hidden").each(function(i) {
			tmpId = this.id.substring(0, this.id.indexOf("_STATUS"));
			if (this.name == "STATUS[]") {
				if (this.id.indexOf("_STATUS_TOP") == -1) {
					var inputObj = $("#" + tmpId + __this.__moduleExt)
				} else {
					var inputObj = $("#" + tmpId + "_top" + __this.__moduleExt)
				}
				if (this.value == 0) {
					inputObj.attr("checked", false)
				} else {
					inputObj.attr("checked", true)
				}
				if (this.id.indexOf("_STATUS_TOP") == -1) {
					__this._checkboxBlur(tmpId)
				} else {
					__this._topCheckboxBlur(tmpId)
				}
			}
		});
		__this.htmlSetCount()
	};
	this.filterMail = function(type) {
		var dataUrlObj = this.dataUrlObj;
		if (false === dataUrlObj) {
			gMessage
					.showMessageMain(
							L("get the data param(listmail) fail: please check the address param again"),
							"fail");
			return false
		}
		dataUrlObj.delParam("is_read");
		dataUrlObj.delParam("is_fwd");
		dataUrlObj.delParam("is_reply");
		dataUrlObj.delParam("is_task");
		switch (type) {
		case "unread":
			__this.filterType = "unread";
			dataUrlObj.addReplaceParam("is_read", "0");
			break;
		case "read":
			__this.filterType = "read";
			dataUrlObj.addReplaceParam("is_read", "1");
			break;
		case "reply":
			__this.filterType = "reply";
			dataUrlObj.addReplaceParam("is_reply", "1");
			break;
		case "forward":
			__this.filterType = "forward";
			dataUrlObj.addReplaceParam("is_fwd", "1");
			break;
		case "task":
			__this.filterType = "task";
			dataUrlObj.addReplaceParam("is_task", "1");
			break;
		default:
			__this.filterType = "all"
		}
		dataUrlObj.addReplaceParam("sort", "time.1.sender.0.subject.0.size.0");
		dataUrlObj.addReplaceParam("page", "1");
		dataUrlObj.addReplaceParam("filter", __this.filterType);
		gModule.loadModule({
			moduleName : "listmail",
			dk : {
				listmail : dataUrlObj
			},
			menuId : __this.__menuId
		})
	};
	this.readMail = function(indexId, actionType, sortStr, isRead, isTop) {
		if (__this.__mailList[indexId]["is_draft"] == 1) {
			var _val = indexId + "_" + __this.__mailList[indexId]["size"] + "_"
					+ __this.folderId + "_" + __this.filterType;
			gIndex.addIndex([ "listmail", "draf", "read" ], _val)
		}
		if (typeof (isTop) !== "undefined" && true == isTop) {
			__this.signLastReadMail("hasread_div_top_" + indexId, indexId, 1)
		} else {
			__this.signLastReadMail("hasread_div_" + indexId, indexId, 0)
		}
		var uc = new UrlControl();
		uc.addReplaceParam("iid", indexId);
		uc.addReplaceParam("action", actionType);
		uc.addReplaceParam("sort", sortStr);
		switch (__this.filterType) {
		case "unread":
			uc.addReplaceParam("is_read", "0");
			break;
		case "read":
			uc.addReplaceParam("is_read", "1");
			break;
		case "reply":
			uc.addReplaceParam("is_reply", "1");
			break;
		case "forward":
			uc.addReplaceParam("is_fwd", "1");
			break;
		default:
		}
		if (false !== __this.resid) {
			uc.addReplaceParam("resid", __this.resid)
		}
		gModule.loadModule({
			moduleName : "compose",
			dk : {
				compose : uc.getUrl()
			}
		})
	};
	this.signLastReadMail = function(pid, iid, isTop) {
		if (g(pid)) {
			var pnode = g(pid)
		} else {
			return false
		}
		var oldId = gLastReadMailIndex;
		if (g("last_read_" + oldId)) {
			var oldPnode = g("last_read_" + oldId).parentNode;
			oldPnode.removeChild(g("last_read_" + oldId))
		}
		var fchildNode = pnode.childNodes[0];
		if (!g("last_read_" + iid)) {
			var insertElement = document.createElement("b");
			insertElement.className = "hasread";
			insertElement.id = "last_read_" + iid;
			insertElement.title = L("lastest read mail");
			if (fchildNode) {
				pnode.insertBefore(insertElement, fchildNode)
			} else {
				pnode.appendChild(insertElement)
			}
		}
		if (isTop == 0) {
			gLastReadMailIndex = iid;
			gTopReadMailIndex = ""
		} else {
			gLastReadMailIndex = iid;
			gTopReadMailIndex = iid
		}
		__this.lastReadMailIndex = gLastReadMailIndex;
		return false
	};
	this.selectInput = function(event, indexId, obj) {
		if (window.event) {
			tg = event.srcElement;
			tn = tg.tagName
		} else {
			tg = event.target;
			tn = tg.nodeName
		}
		if (tn == "SPAN" || tn == "FONT" || tn == "A" || tn == "INPUT"
				|| tn == "B") {
			return 0
		}
		var chkObj;
		if (obj.id.indexOf("top") == -1) {
			chkObj = g(indexId + __this.__moduleExt)
		} else {
			chkObj = g(indexId + "_top" + __this.__moduleExt)
		}
		chkObj.checked = !chkObj.checked;
		chkObj.focus();
		chkObj.blur()
	};
	this.sort = function(sortstr, item, page) {
		eval("var re = /^(.*)(" + item + ".)(0|1)(.?)(.*)$/");
		sortstr = sortstr.replace(re, function($0, $1, $2, $3, $4, $5) {
			if ($3 == "0") {
				var odrstr = $2 + "1"
			} else {
				var odrstr = $2 + "0"
			}
			if ($1 == "") {
				return odrstr + $4 + $5
			}
			if ($4 !== ".") {
				if ($1 !== "") {
					return odrstr + "." + $1.substring(0, $1.length - 1)
				} else {
					return odrstr
				}
			}
			return odrstr + "." + $1 + $5
		});
		var url = __this.modifyLocation(__this.folderId, page, sortstr);
		if (false !== url) {
			gModule.loadModule({
				moduleName : "listmail",
				dk : {
					listmail : url
				},
				menuId : __this.__menuId
			})
		}
	};
	this.goPage = function(page, sortstr, fid) {
		function go() {
			if (typeof sortstr === "undefined") {
				sortstr = __this.sortStr
			}
			if (typeof fid === "undefined") {
				fid = __this.folderId
			}
			var url = __this.modifyLocation(fid, page, sortstr);
			if (false !== url) {
				gModule.loadModule({
					moduleName : "listmail",
					dk : {
						listmail : url
					},
					menuId : __this.__menuId
				})
			}
		}
		if (__this.pageTime) {
			clearTimeout(__this.pageTime)
		}
		__this.pageTime = _setTimeout(go, 50)
	};
	this.jumpPage = function(page, sortstr, fid) {
		function go() {
			if (typeof sortstr === "undefined") {
				sortstr = __this.sortStr
			}
			if (typeof fid === "undefined") {
				fid = __this.folderId
			}
			var url = __this.modifyLocation(fid, page, sortstr);
			if (false !== url) {
				gModule.loadModule({
					moduleName : "listmail",
					dk : {
						listmail : url
					},
					menuId : __this.__menuId
				})
			}
		}
		if (__this.pageTime) {
			clearTimeout(__this.pageTime)
		}
		__this.pageTime = _setTimeout(go, 200)
	};
	this.htmlSetCount = function() {
		var c = __this.getCountByType();
		g("count1" + __this.__moduleExt).innerHTML = c.count;
		g("count2" + __this.__moduleExt).innerHTML = c.count;
		g("count3" + __this.__moduleExt).innerHTML = __this.selCount;
		g("count4" + __this.__moduleExt).innerHTML = __this.selCount;
		g("size1" + __this.__moduleExt).innerHTML = formatBytes(c.size, 0, "",
				1);
		g("size2" + __this.__moduleExt).innerHTML = formatBytes(c.size, 0, "",
				1);
		g("size3" + __this.__moduleExt).innerHTML = formatBytes(__this.selSize,
				0, "", 1);
		g("size4" + __this.__moduleExt).innerHTML = formatBytes(__this.selSize,
				0, "", 1)
	};
	this.merge = function(first, second) {
		$.each(second, function(m, n) {
			if (jQuery.inArray(n, first) == -1) {
				first.push(n)
			}
		});
		return first
	};
	this.getSelMail = function() {
		var res = gIndex.getIndex([ "listmail", __this.folderId,
				__this.filterType ]);
		var topRes = gIndex
				.getIndex([ "listmail", __this.folderId, "tasktop" ]);
		var _res = [];
		for (p in res) {
			_res.push(p)
		}
		for (v in topRes) {
			if (typeof (res[v]) === "undefined") {
				_res.push(v)
			}
		}
		return _res.join(",")
	};
	this.delMail = function(isReal) {
		var delStr = isReal ? L("delete downright") : L("delete");
		var selMail = this.getSelMail();
		if (selMail === "") {
			gMessage.showMessageMain(sprintf(
					L("please choose the email that you want to %s"), delStr),
					"fail");
			return
		}
		if (isReal
				&& !confirm(L("are you sure to delete the email that you selected"))) {
			return
		}
		if (isReal) {
			var action = "del"
		} else {
			var action = "recycle"
		}
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(delStr + L("email fail")
					+ gCheck.getRestrictMessage({
						type : "systemError"
					}), "fail")
		}
		$.ajax({
			url : gUrlPrefix + "?q=compose.del.do",
			data : "action=" + action + "&iid=" + selMail + "&fid="
					+ __this.folderId,
			dataType : "json",
			type : "POST",
			success : __this.afterDel,
			error : processError
		})
	};
	this.moveMail = function(v) {
		var selMail = this.getSelMail();
		if (selMail === "") {
			gMessage.showMessageMain(
					L("please choose the email that you want to move"), "fail");
			return
		}
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(L("move the email fail")
					+ gCheck.getRestrictMessage({
						type : "systemError"
					}), "fail")
		}
		var toFid = v;
		$.ajax({
			url : gUrlPrefix + "?q=compose.del.do",
			data : "action=move&iid=" + selMail + "&to_fid=" + toFid + "&fid="
					+ __this.folderId,
			dataType : "json",
			type : "POST",
			success : __this.afterDel,
			error : processError
		})
	};
	this.dragMail = function(iid, fid) {
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(L("move the email fail")
					+ gCheck.getRestrictMessage({
						type : "systemError"
					}), "fail")
		}
		var selMail;
		if (getType(iid) === "array") {
			selMail = iid.join(",")
		} else {
			selMail = iid
		}
		$.ajax({
			url : gUrlPrefix + "?q=compose.del.do",
			data : "action=move&iid=" + selMail + "&to_fid=" + fid + "&fid="
					+ __this.folderId,
			dataType : "json",
			type : "POST",
			success : __this.afterDel,
			error : processError
		})
	};
	this.afterDel = function(o) {
		if (o._login !== 1) {
			alert(gCheck.getRestrictMessage({
				type : "notLogin"
			}));
			gModule.logout();
			return
		}
		var typeStr;
		switch (o.data.type) {
		case "recycle":
			typeStr = L("delete") + L("_mail");
			break;
		case "del":
			typeStr = L("delete downright") + L("_mail");
			break;
		case "move":
			typeStr = L("move to") + L("_mail");
			break;
		case "read2unread":
			typeStr = L("read2unread") + L("_mail");
			break;
		case "unread2read":
			typeStr = L("unread2read") + L("_mail");
			break;
		case "task":
			typeStr = L("task") + L("_mail");
			break;
		case "untask":
			typeStr = L("untask") + L("_mail");
			break;
		case "color":
			typeStr = L("set mail web color");
			break;
		case "remarks":
			typeStr = L("save mail remarks");
			break;
		case "unremarks":
			typeStr = L("del mail remarks");
			break;
		case "markspam":
			typeStr = L("mark spam");
			break;
		case "unmarkspam":
			typeStr = L("unmark spam");
			break;
		default:
			return
		}
		if (o.res === 0) {
			gMessage.showMessageMain(typeStr + L("fail")
					+ gCheck.getRestrictMessage({
						type : "systemError"
					}), "fail");
			return
		} else {
			gMessage.showMessageMain(typeStr + L("success"), "success")
		}
		if (o.data.success.length > 0) {
			__this.tidySelIndex(o.data.success)
		}
		__this.mailStatusOnChange(true)
	};
	this.mailStatusOnChange = function(flag) {
		if (typeof flag === "undefined") {
			flag = false
		}
		if (flag) {
			gModule.setRecentMail(1)
		} else {
			gModule.setRecentMail(-1)
		}
	};
	this.tidySelIndex = function(arrIndex) {
		var fid = __this.folderId;
		gIndex.delIndex([ "listmail", fid, "all" ], arrIndex);
		gIndex.delIndex([ "listmail", fid, "unread" ], arrIndex);
		gIndex.delIndex([ "listmail", fid, "read" ], arrIndex);
		gIndex.delIndex([ "listmail", fid, "reply" ], arrIndex);
		gIndex.delIndex([ "listmail", fid, "forward" ], arrIndex);
		gIndex.delIndex([ "listmail", fid, "task" ], arrIndex);
		gIndex.delIndex([ "listmail", fid, "untask" ], arrIndex);
		gIndex.delIndex([ "listmail", fid, "tasktop" ], arrIndex)
	};
	this.setMainSize = function() {
		gModule.showActiveModule()
	};
	this.selectOver = function() {
		g("chose_none" + __this.__moduleExt).style.display = ""
	};
	this.selectOut = function() {
		g("chose_none" + __this.__moduleExt).style.display = "none"
	};
	this.bodyClick = function(e) {
		var targ;
		if (!e) {
			var e = window.event
		}
		if (e.target) {
			targ = e.target
		} else {
			if (e.srcElement) {
				targ = e.srcElement
			}
		}
		if (targ.nodeType == 3) {
			targ = targ.parentNode
		}
		var filterId = [ "chose_btn" ];
		if (jQuery.inArray(targ.id, filterId) == -1) {
			this.selectOut()
		}
	};
	this.init = function() {
		__this.__menuId = gModule.getModuleStatus(__this.__moduleId);
		var tplRes = gModule.fetchTemplate(__this.__moduleId, function(mid,
				tpl_data) {
			g(mid).innerHTML = tpl_data;
			__this.loadPage()
		});
		if (false === tplRes) {
			gMessage.showMessageMain(sprintf(L("load %s template fail"),
					__this.__moduleId), "fail")
		}
		__this.createPopWindow()
	};
	this.getCountByType = function() {
		var type = __this.filterType;
		var res = gIndex.getIndex([ "listmail", __this.folderId, type ]);
		var topRes = gIndex
				.getIndex([ "listmail", __this.folderId, "tasktop" ]);
		var size = 0;
		var count = getCount(res) + getCount(topRes);
		for (k in res) {
			size += k.split("_")[1] - 0
		}
		for (kk in topRes) {
			if (typeof (res[kk]) === "undefined") {
				size += kk.split("_")[1] - 0
			}
		}
		return {
			count : count,
			size : size
		}
	};
	this.changeMailStatus = function(mailStatus, iid) {
		if (typeof (mailStatus) === "undefined") {
			return false
		}
		if (typeof (iid) == "undefined") {
			var selMail = this.getSelMail();
			if (selMail == "") {
				gMessage.showMessageMain(
						L("please choose the email that you want to modify"),
						"fail");
				return false
			}
		} else {
			var selMail = iid;
			if (selMail == "") {
				return false
			}
		}
		var readStr = L(mailStatus);
		var action = mailStatus;
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(readStr + L("email fail")
					+ gCheck.getRestrictMessage({
						type : "systemError"
					}), "fail")
		}
		$.ajax({
			url : gUrlPrefix + "?q=listmail.do",
			data : "action=" + action + "&iid=" + selMail + "&fid="
					+ __this.folderId,
			dataType : "json",
			type : "POST",
			success : __this.afterDel,
			error : processError
		});
		return false
	};
	this.colorMail = function(color, iid) {
		if (typeof (color) == "undefined") {
			return false
		}
		if (typeof (iid) == "undefined") {
			var selMail = this.getSelMail();
			if (selMail == "") {
				gMessage.showMessageMain(
						L("please choose the email that you want to modify"),
						"fail");
				return false
			}
		} else {
			var selMail = iid;
			if (selMail == "") {
				return false
			}
		}
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(readStr + L("email fail")
					+ gCheck.getRestrictMessage({
						type : "systemError"
					}), "fail")
		}
		$.ajax({
			url : gUrlPrefix + "?q=listmail.do",
			data : "action=color&iid=" + selMail + "&fid=" + __this.folderId
					+ "&value=" + color,
			dataType : "json",
			type : "POST",
			success : __this.afterDel,
			error : processError
		});
		return false
	};
	this.remarksMail = function(opt, iid, remarkVal) {
		if (typeof (opt) == "undefined" || typeof (iid) == "undefined") {
			return false
		}
		if (typeof (remarkVal) == "undefined") {
			remarkVal = ""
		}
		if (opt == "remarks") {
			if ("" == remarkVal) {
				gMessage
						.showMessageMain(L("mail remarks can not null"), "fail");
				return false
			}
			var readStr = L("save mail remarks")
		} else {
			remarkVal = "";
			var readStr = L("del mail remarks")
		}
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(readStr + L("email fail")
					+ gCheck.getRestrictMessage({
						type : "systemError"
					}), "fail")
		}
		$.ajax({
			url : gUrlPrefix + "?q=listmail.do",
			data : "action=" + opt + "&iid=" + iid + "&fid=" + __this.folderId
					+ "&value=" + encodeURIComponent(remarkVal),
			dataType : "json",
			type : "POST",
			success : __this.afterDel,
			error : processError
		});
		return false
	};
	this.setPageRead = function() {
		var readStr = L("unread2read");
		var selMail = __this.unreadMail.join(",");
		var action = "unread2read";
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(readStr + L("email fail")
					+ gCheck.getRestrictMessage({
						type : "systemError"
					}), "fail")
		}
		$.ajax({
			url : gUrlPrefix + "?q=listmail.do",
			data : "action=" + action + "&iid=" + selMail + "&fid="
					+ __this.folderId,
			dataType : "json",
			type : "POST",
			success : __this.afterDel,
			error : processError
		});
		return false
	};
	this.getListMailRow = function(menu, key) {
		var noRowDis = true;
		var columns = [];
		var thisItemChecked = !this.isChecked;
		for ( var k in __this.listMailRowValue) {
			if (k === key) {
				if (thisItemChecked) {
					columns.push(k);
					noRowDis = false
				}
			} else {
				if (__this.listMailRowValue[k]) {
					columns.push(k);
					noRowDis = false
				}
			}
		}
		if (noRowDis == true) {
			gMessage.showMessageMain(L("you must choose the row at least one"),
					"fail");
			return false
		}
		gMessage.showMessageTop();
		$.ajax({
			url : gUrlPrefix + "?q=listmail.columns.do",
			data : "columns=" + columns.join(","),
			type : "get",
			dataType : "json",
			success : function(o) {
				gMessage.hideMessageTop();
				if (o.res == 0) {
					gMessage.showMessageMain(o.error, "fail")
				} else {
					gCc.cleanCache({
						q : "listnotice",
						type : "page"
					});
					gCc.cleanCache({
						q : "listmail",
						type : "page"
					});
					__this.goPage(__this.page)
				}
			},
			error : function(xmlHttp, error, e) {
				gMessage.hideMessageTop();
				gMessage.showMessageMain(error, "fail")
			}
		})
	};
	this.disSortMail = function(obj, iid, type) {
		if (typeof (obj) === "undefined" || typeof (iid) === "undefined"
				|| typeof (type) === "undefined") {
			return false
		}
		var disstates = g(iid).style.display == "none" ? "" : "none";
		if (type === "date") {
			var mailClass = disstates == "none" ? "side_close" : "side_open";
			var mailTitle = disstates == "none" ? L("unfold") : L("fold")
		} else {
			if (type === "rel") {
				var mailClass = disstates == "none" ? "side_close"
						: "side_open";
				var mailTitle = disstates == "none" ? "显示线索邮件" : "隐藏线索邮件"
			}
		}
		if (typeof (obj) !== "object") {
			obj = "#" + obj
		}
		$(obj).attr("class", mailClass);
		$(obj).attr("title", mailTitle);
		$("#" + iid).css("display", disstates)
	};
	this.selSortMail = function(iid, type) {
		var isSel = false;
		$("#" + iid).find("input:checkbox").each(function(i) {
			if (this.name == "MSG[]") {
				if (this.checked !== true) {
					isSel = true;
					return false
				}
			}
		});
		$("#" + iid).find("input:checkbox").each(
				function(i) {
					if (this.name == "MSG[]") {
						this.checked = isSel
					}
					if (typeof (type) !== "undefined" && type == "top") {
						__this._topCheckboxBlur(this.id.substr(0, this.id
								.indexOf("top_" + __this.__moduleId) - 1))
					} else {
						__this._checkboxBlur(this.id.substr(0, this.id
								.indexOf(__this.__moduleId) - 1))
					}
				});
		__this.htmlSetCount()
	};
	this.forwardMailAsAttch = function(type) {
		if (typeof (type) == "undefined" || "" == type) {
			return false
		}
		var sSelMail = this.getSelMail();
		if (sSelMail === "") {
			gMessage.showMessageMain(
					L("please choose the emails that you want to forward"),
					"fail");
			return false
		} else {
			__this.initJson(type, sSelMail)
		}
	};
	this.initJson = function(type, selMail) {
		function processError(errcode, errinfo) {
			gMessage.showMessageMain(L("init the json fail:")
					+ gCheck.getRestrictMessage({
						type : "systemError"
					}), "fail")
		}
		$
				.ajax({
					url : gUrlPrefix + "?q=compose.init.do",
					data : "iid=" + selMail + "&action=" + type,
					type : "get",
					dataType : "json",
					success : function(o) {
						if (o._login !== 1) {
							gModule.logout();
							return false
						}
						var errormsg = "";
						if (o.res !== 0) {
							switch (o.res) {
							case 100001:
								errormsg = L("the acct_id or index_id can not be null");
								break;
							case 100002:
								errormsg = L("get the user email index fail");
								break;
							case 100021:
								errormsg = L("init the json fail");
								break;
							case 100022:
								errormsg = L("the attach size above the system limit");
								break;
							case 100023:
								errormsg = L("the email size above the system limit");
								break;
							case 100024:
								errormsg = L("the total number of attach above the system limit");
								break;
							default:
								errormsg = L("init the json fail");
								break
							}
							gMessage.showMessageMain(errormsg, "fail");
							return false
						} else {
							selMail = selMail.replace(/,/g, "_");
							gModule
									.loadModule({
										moduleName : "compose",
										dk : {
											compose : "?action=compose.forward.attaches&iid="
													+ selMail
													+ "&rand_num="
													+ o.json_rand_num
										}
									})
						}
					},
					error : processError
				})
	};
	this.initSearch = function() {
		var htmlString = [], i = 0, htmlArray = "", flag = "";
		var searchArea = gModule.getFolderList();
		delete searchArea[gFidTime];
		for ( var folderId in searchArea) {
			__this.__folderIdArray[i] = folderId;
			htmlString[i++] = [ '<option value="', folderId, '">',
					searchArea[folderId]["fname"], "</option>" ].join("")
		}
		$("#folder" + __this.__moduleExt).append(htmlString.join(""));
		$("#enddate" + __this.__moduleExt).datepicker(
				{
					dateFormat : "yy-mm-dd",
					yearRange : "1990:" + (new Date()).getFullYear(),
					prevText : L("prev month"),
					nextText : L("next month"),
					changeYear : true,
					changeMonth : true,
					gotoCurrent : true,
					navigationAsDateFormat : true,
					maxDate : new Date(),
					firstDay : 1,
					dayNamesMin : L("Su,Mo,Tu,We,Th,Fr,Sa").split(","),
					monthNamesShort : L(
							"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec")
							.split(",")
				});
		var searchForm = document["form1" + __this.__moduleExt];
		$(searchForm.limit_attach_type).click(function() {
			if (this.checked) {
				$(this.form["attach_type[]"]).removeAttr("disabled")
			} else {
				$(this.form["attach_type[]"]).attr("disabled", "disabled")
			}
		});
		$(searchForm).bind("reset", function() {
			searchForm.startdate.disabled = true;
			searchForm.enddate.disabled = true;
			$("#startdatepanel" + __this.__moduleExt).hide();
			$(searchForm["attach_type[]"]).each(function() {
				this.disabled = true
			})
		});
		gMessage.hideMessageTop()
	};
	this.checkEndDate = function() {
		var searchForm = document["form1" + __this.__moduleExt];
		if (searchForm.un_limit_end.checked) {
			$(searchForm.enddate).removeAttr("disabled")
		} else {
			$(searchForm.enddate).attr("disabled", "disabled")
		}
	};
	this.selectDate = function() {
		var searchForm = document["form1" + __this.__moduleExt];
		var selectDate = searchForm.duration_date;
		var selectValue = selectDate.options[selectDate.options.selectedIndex].value;
		if (selectValue == 0) {
			$(searchForm.startdate).removeAttr("disabled");
			$("#startdatepanel" + __this.__moduleExt).show()
		} else {
			$(searchForm.startdate).attr("disabled", "disabled");
			$("#startdatepanel" + __this.__moduleExt).hide()
		}
	};
	this.search = function() {
		var customDate = g("startdate" + __this.__moduleExt);
		if (customDate.disabled == false) {
			if (!customDate.value.match(/\d+/)) {
				gMessage.showMessageMain(L("custom date value be number"),
						"fail");
				customDate.focus();
				return
			}
		}
		var uc = new UrlControl();
		gCc.cleanCache({
			q : "listmail",
			uc : uc,
			type : "page"
		});
		var fid = "search";
		gIndex.delPath([ "listmail", fid, "all" ]);
		gIndex.delPath([ "listmail", fid, "unread" ]);
		gIndex.delPath([ "listmail", fid, "read" ]);
		gIndex.delPath([ "listmail", fid, "reply" ]);
		gIndex.delPath([ "listmail", fid, "forward" ]);
		var transferData = $("#form1" + __this.__moduleExt).serialize();
		var searchForm = document["form1" + __this.__moduleExt];
		$.ajax({
			url : gUrlPrefix + "?q=search.mail.do",
			type : "post",
			data : transferData,
			dataType : "json",
			cache : false,
			success : function(resp) {
				if (0 === resp._login) {
					alert(gCheck.getRestrictMessage({
						type : "notLogin"
					}));
					gModule.logout()
				} else {
					if (0 === resp.res) {
						if ("" != resp.error) {
							gMessage.showMessageMain(resp.error, "fail")
						} else {
							gMessage.showMessageMain(L("search email error")
									+ gCheck.getRestrictMessage({
										type : "dataError",
										name : L("search email")
									}), "fail")
						}
						return false
					}
				}
				var data = resp.data;
				var urlObj = new UrlControl();
				urlObj.setUrl("?fid=search");
				urlObj.addReplaceParam("resid", data);
				gModule.loadModule({
					moduleName : "listmail",
					dk : {
						listmail : urlObj.getUrl()
					},
					menuId : __this.__menuId
				});
				return true
			},
			error : function() {
				gMessage.hideMessageTop();
				gMessage.showMessageMain(L("search email fail")
						+ gCheck.getRestrictMessage({
							type : "systemError"
						}), "fail");
				return false
			}
		})
	};
	this.fillSearchForm = function(formData) {
		if (typeof (formData) != "object") {
			return
		}
		var searchForm = document["form1" + __this.__moduleExt];
		for (p in formData) {
			switch (p) {
			case "attach_type":
				var tmpArr = formData[p];
				var tmpIndex;
				for ( var i = 0; i < tmpArr.length; i++) {
					tmpIndex = parseInt(tmpArr[i]);
					if (tmpIndex == 0) {
						tmpIndex = 7
					}
					searchForm["attach_type[]"][tmpIndex - 1].checked = true
				}
				break;
			case "limit_attach_type":
			case "un_limit_end":
				searchForm[p].click();
				break;
			case "duration_date":
			case "folder":
				for ( var i = 0; i < searchForm[p].options.length; i++) {
					if (formData[p] == searchForm[p].options[i].value) {
						searchForm[p].options[i].selected = true;
						if (p == "duration_date") {
							__this.selectDate()
						}
					}
				}
				break;
			default:
				searchForm[p].value = formData[p]
			}
		}
	};
	this.searchFormStatus = function(flag) {
		domNode = g("closeicon" + __this.__moduleExt);
		var clssName = $(domNode).attr("class");
		if (flag === undefined) {
			flag = clssName === "closebutton" ? "open" : "close"
		}
		if (flag === "open") {
			$("#search" + __this.__moduleExt).hide();
			$(domNode).attr("class", "openbutton");
			$("#keyword_info" + __this.__moduleExt).show();
			domNode.innerHTML = L("open search form");
			domNode.title = L("click open")
		} else {
			$("#search" + __this.__moduleExt).show();
			$(domNode).attr("class", "closebutton");
			$("#keyword_info" + __this.__moduleExt).hide();
			domNode.innerHTML = L("close search form");
			domNode.title = L("click close")
		}
	};
	this.setKeywordInfo = function() {
		var domNode = g("keyword_info" + __this.__moduleExt);
		var searchForm = document["form1" + __this.__moduleExt];
		var text = [];
		var curNode;
		var keys = [ "area_subject", "area_content", "area_from", "area_to",
				"area_attach" ];
		curNode = searchForm.duration_date;
		var timeStr = curNode.options[curNode.options.selectedIndex].innerHTML;
		if (curNode.options[curNode.options.selectedIndex].value == 0) {
			timeStr += searchForm.startdate.value + L("day")
		}
		timeStr += L("in duration") + "," + L("from the time point") + "";
		if (searchForm.un_limit_end.checked
				&& searchForm.un_limit_end.value != "") {
			timeStr += searchForm.enddate.value
		} else {
			timeStr += toDate("Y-m-d")
		}
		text.push("<b>" + $(curNode.parentNode).prev().html() + '</b>: "'
				+ timeStr + '"');
		curNode = searchForm.folder;
		text.push("<b>" + $(curNode.parentNode).prev().html() + '</b>: "'
				+ curNode.options[curNode.options.selectedIndex].innerHTML
				+ '"');
		for ( var i = 0; i < keys.length; i++) {
			curNode = searchForm[keys[i]];
			if (curNode.value == "") {
				continue
			}
			text.push("<b>" + $(curNode.parentNode).prev().html() + '</b>: "'
					+ htmlSpecialChars(curNode.value) + '"')
		}
		domNode.innerHTML = text.join(",");
		curNode = searchForm["attach_type[]"];
		var attach = [];
		for ( var i = 0; i < curNode.length; i++) {
			if (curNode[i].checked) {
				attach.push('"' + $(curNode[i]).next().text() + '"')
			}
		}
		if (attach.length > 0) {
			text
					.push("<b>"
							+ $(
									searchForm.limit_attach_type.parentNode.parentNode.parentNode)
									.prev().html() + "</b>: "
							+ attach.join(","))
		}
		domNode.innerHTML = forceWrap(text.join(" | "))
	};
	this.initImportMail = function(rcptSize, disp) {
		if (__this.folderId === gFidTime) {
			return
		}
		var params = {
			module_id : __this.__moduleId,
			fid : __this.folderId
		};
		var cookieStr = document.cookie;
		if (cookieStr != "") {
			var cookieArr = cookieStr.split(";");
			var everyCookie, cookieKey, cookieValue, splitPos;
			for (i = 0; i < cookieArr.length; i++) {
				everyCookie = cookieArr[i].replace(/(^\s*)|(\s*$)/g, "");
				if (everyCookie != "") {
					splitPos = everyCookie.indexOf("=");
					if (splitPos == -1) {
						continue
					}
					cookieKey = everyCookie.substr(0, splitPos);
					cookieValue = everyCookie.substr(splitPos + 1);
					params[cookieKey] = cookieValue
				}
			}
		}
		__this.uploadSettings = {
			url : gUrlPrefix + "?q=listmail.import.do&zid=" + gZid,
			url2 : gUrlPublicPrefix + "?q=upload.status",
			params : params,
			multi : true,
			duration : 1000,
			container : __this.__moduleId,
			prefix : __this.__moduleId,
			onStart : function(key, file) {
				var colCount = __this.getColCount();
				if (!g("import_mail" + __this.__moduleExt)) {
					$("#list_header" + __this.__moduleExt)
							.after(
									'<tbody id="import_mail'
											+ __this.__moduleExt
											+ '" style="display:"><tr class="divbg"><td colspan="'
											+ colCount
											+ '"><div id=""><b name="7" onclick="O(\''
											+ __this.__moduleId
											+ '\').dispImportMail(this);" class="side_open" title="'
											+ L("fold")
											+ '"/><div id="" style="float:left;">'
											+ L("importing mails")
											+ "</div></div></td></tr></tbody>");
					$("#import_mail" + __this.__moduleExt).after(
							'<tbody id="import_mail_list' + __this.__moduleExt
									+ '"></tbody>')
				}
				var html = '<ul class="fj_w"><li class="clear" id="up_'
						+ key
						+ __this.__moduleExt
						+ '"><em></em><span>'
						+ htmlSpecialChars(file)
						+ '</span><i><small></small></i><a href="javascript:enjoy()" onclick="O(\''
						+ __this.__moduleId + "').cancelMailUpload('" + key
						+ "')\">" + L("cancel") + "</a></li></ul>";
				$("#import_mail_list" + __this.__moduleExt).append(
						'<tr id="mail_' + key + __this.__moduleExt
								+ '"><td colspan="' + colCount + '">' + html
								+ "</td></tr>");
				__this.uploading = true
			},
			onCancel : function(key, file) {
				$("#mail_" + key + __this.__moduleExt).remove()
			},
			onError : function(key, file, error) {
				alert(error);
				$("#mail_" + key + __this.__moduleExt).remove()
			},
			onProgress : function(key, file, total, current, rate) {
				var percent = Math.ceil((current / total) * 100);
				$("#up_" + key + __this.__moduleExt + " > i > small").width(
						percent + "%")
			},
			onDone : function(key, file, o) {
				try {
					__this.afterImport(o, key)
				} catch (ex) {
				}
				if (this.getCount() == 0) {
					__this.uploading = false;
					if (true == __this.importHasSuccess) {
						__this.mailStatusOnChange(true);
						gCc.cleanCache({
							q : "listmail",
							uc : __this.dataUrlObj
						})
					} else {
						if (g("import_mail" + __this.__moduleExt)) {
							$("#import_mail" + __this.__moduleExt).remove()
						}
						if (g("import_mail_list" + __this.__moduleExt)) {
							$("#import_mail_list" + __this.__moduleExt)
									.remove()
						}
					}
				}
			}
		};
		__this.swfSettings = {
			upload_url : gUrlPrefix + "?q=listmail.import.do&zid=" + gZid,
			post_params : params,
			file_size_limit : rcptSize + "MB",
			file_upload_limit : 0,
			display_name : disp,
			file_types : "*.eml|*.*",
			file_types_description : L("email backup|all files"),
			file_queued_handler : function(file) {
				var colCount = __this.getColCount();
				if (!g("import_mail" + __this.__moduleExt)) {
					$("#list_header" + __this.__moduleExt)
							.after(
									'<tbody id="import_mail'
											+ __this.__moduleExt
											+ '" style="display:"><tr class="divbg"><td colspan="'
											+ colCount
											+ '"><div id=""><b name="7" onclick="O(\''
											+ __this.__moduleId
											+ '\').dispImportMail(this);" class="side_open" title="'
											+ L("fold")
											+ '"/><div id="" style="float:left;">'
											+ L("importing mails")
											+ "</div></div></td></tr></tbody>");
					$("#import_mail" + __this.__moduleExt).after(
							'<tbody id="import_mail_list' + __this.__moduleExt
									+ '"></tbody>')
				}
				var html = '<ul class="fj_w"><li class="clear" id="up_'
						+ file.id
						+ __this.__moduleExt
						+ '"><em></em><span>'
						+ htmlSpecialChars(file.name)
						+ " ("
						+ formatBytes(file.size, 0)
						+ ')</span><i><small></small></i><a href="javascript:enjoy()" onclick="O(\''
						+ __this.__moduleId + "').cancelMailUpload('" + file.id
						+ "')\">" + L("cancel") + "</a></li></ul>";
				$("#import_mail_list" + __this.__moduleExt).append(
						'<tr id="mail_' + file.id + __this.__moduleExt
								+ '"><td colspan="' + colCount + '">' + html
								+ "</td></tr>");
				__this.uploading = true
			},
			file_queue_error_handler : function(file, errorCode, message) {
				try {
					var errorName = "";
					switch (errorCode) {
					case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
						errorName = L("you can not upload a empty file");
						break;
					case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
						errorName = L("the file is too big");
						break;
					case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
						errorName = L("the upload file number is above the limit");
						break;
					case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
						errorName = L("the file type is wrong");
						break;
					default:
						errorName = L("system error");
						break
					}
					if (errorName !== "") {
						alert(errorName);
						$("#mail_" + file.id + __this.__moduleExt).remove();
						return
					}
				} catch (ex) {
				}
			},
			file_dialog_complete_handler : function(numFilesSelected,
					numFilesQueued) {
				try {
					if (numFilesQueued > 0) {
						var swfObj = gUploadManager
								.getModuleSwfObject(__this.__moduleId);
						swfObj.startUpload()
					} else {
					}
				} catch (ex) {
				}
			},
			upload_progress_handler : function(file, bytesLoaded) {
				try {
					var percent = Math.ceil((bytesLoaded / file.size) * 100);
					$("#up_" + file.id + __this.__moduleExt + " > i > small")
							.width(percent + "%")
				} catch (ex) {
				}
			},
			upload_error_handler : function(file, errorCode, message) {
				var errorInfo = "";
				try {
					switch (errorCode) {
					case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
						try {
							$("#mail_" + file.id + __this.__moduleExt).remove();
							return
						} catch (ex1) {
						}
						break;
					case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
						return;
						break;
					case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
						errorInfo = L("above the max limit");
						break;
					default:
						errorInfo = message;
						break
					}
					alert(errorInfo);
					$("#mail_" + file.id + __this.__moduleExt).remove()
				} catch (ex3) {
				}
			},
			upload_success_handler : function(file, serverData) {
				try {
					var serverDataObj = eval("(" + serverData + ")");
					__this.afterImport(serverDataObj, file)
				} catch (ex) {
				}
			},
			upload_complete_handler : function(file) {
				try {
					var swfObj = gUploadManager
							.getModuleSwfObject(__this.__moduleId);
					if (swfObj.customSettings.pauseFileId == "") {
						if (swfObj.getStats().files_queued > 0) {
							swfObj.startUpload()
						} else {
							__this.uploading = false;
							if (true == __this.importHasSuccess) {
								__this.mailStatusOnChange(true);
								gCc.cleanCache({
									q : "listmail",
									uc : __this.dataUrlObj
								})
							} else {
								if (g("import_mail" + __this.__moduleExt)) {
									$("#import_mail" + __this.__moduleExt)
											.remove()
								}
								if (g("import_mail_list" + __this.__moduleExt)) {
									$("#import_mail_list" + __this.__moduleExt)
											.remove()
								}
							}
						}
					}
				} catch (ex) {
				}
			}
		};
		gModule.setTopMenu(__this.__menuId, {
			closeProc : __this.canClose
		})
	};
	this.cancelMailUpload = function(fileId) {
		if (typeof (fileId) == "undefined") {
			return false
		}
		if (gSupportFlash && gUploadType == 2) {
			var swfObj = gUploadManager.getModuleSwfObject(__this.__moduleId);
			swfObj.cancelUpload(fileId)
		} else {
			__this.uploadObject.stop(fileId)
		}
	};
	this.registeSwfUplod = function() {
		if (gSupportFlash && gUploadType == 2) {
			gUploadManager.registerSwfUpload(__this.__moduleId,
					__this.swfSettings)
		}
	};
	this.dispImportMail = function(b) {
		var o = g("import_mail_list" + __this.__moduleExt);
		if (!o) {
			return
		}
		if (o.style.display === "none") {
			o.style.display = "";
			$(b).attr("class", "side_open").attr("title", L("fold"))
		} else {
			o.style.display = "none";
			$(b).attr("class", "side_close").attr("title", L("unfold"))
		}
	};
	this.afterImport = function(o, file) {
		if (o._login == 0) {
			alert(gCheck.getRestrictMessage({
				type : "notLogin"
			}));
			gModule.logout();
			return
		}
		if (o.error != "") {
			if (typeof (file) === "string") {
				$("#mail_" + file + __this.__moduleExt).remove()
			} else {
				$("#mail_" + file.id + __this.__moduleExt).remove()
			}
			gMessage.showMessageMain(o.error, "fail");
			return false
		}
		__this.importHasSuccess = true;
		var data = o.data;
		var htmlList = [];
		var folderList = gFc.getFolderList();
		var iconTitle, thisSender, thisSender2, thisSubject, thisSubject2, thisIndexId, isChecked, thisIsRead, thisIsDraft, thisIsFwd, thisIsReply, thisMailTime, thisFolderName, thisSize, thisData, thisTdClass, thisAttach, thisTaskClass, thisWebColorClass, thisRemarksClass;
		var actionType = __this.actionType;
		var sortField = __this.sortField;
		for ( var i = 0; i < data.length; i++) {
			thisData = data[i];
			thisIsRead = thisData.is_read;
			thisIsDraft = thisData.is_draft;
			thisIsFwd = thisData.is_fwd;
			thisIsReply = thisData.is_reply;
			thisIndexId = thisData.mail_id;
			thisSubject = thisData.subject_digest ? thisData.subject_digest
					: L("no topic");
			thisSubject2 = htmlSpecialChars(thisSubject);
			if (__this.folderId == 3 || __this.folderId == 2
					|| 2 === __this.show_all) {
				thisSender = thisData.to_display;
				thisSender2 = thisData.to_digest
			} else {
				thisSender = thisData.from_display;
				thisSender2 = thisData.from_digest
			}
			thisSender = htmlSpecialChars(thisSender);
			thisSender2 = htmlSpecialChars(thisSender2);
			thisMailTime = thisData.index_time;
			thisSize = thisData.size;
			if ((thisData.media_type - 0) & 1) {
				thisAttach = '<b class="ivoice"></b>'
			} else {
				if ((thisData.media_type - 0) & 2) {
					thisAttach = '<b class="ivideo"></b>'
				} else {
					if (thisData.has_attach != 0) {
						thisAttach = '<b class="enclosure"></b>'
					} else {
						thisAttach = ""
					}
				}
			}
			isChecked = "";
			if (thisIsRead == 1) {
				thisTdClass = ""
			} else {
				thisTdClass = " noread"
			}
			if (isChecked) {
				thisTdClass = thisTdClass ? thisTdClass + " bgcolor2"
						: " bgcolor2"
			}
			thisFolderName = folderList[thisData.folder_id].fname;
			htmlList = [
					'<tr class="drag_tr',
					thisTdClass,
					'" onmouseover="',
					__this.__thisName,
					".trMouseOver(",
					thisIndexId,
					', this);" onmouseout="',
					__this.__thisName,
					".trMouseOut(",
					thisIndexId,
					', this);"  onClick="',
					__this.__thisName,
					".selectInput(event,",
					thisIndexId,
					', this);"  id="tr_',
					thisIndexId + __this.__moduleExt,
					'">',
					'<td id="data_title_' + thisIndexId
							+ '" class="movetd_input" title="',
					thisSubject2,
					'"><input type="hidden" name="STATUS[]" value="',
					thisIsRead,
					'" id="',
					thisIndexId,
					"_STATUS" + __this.__moduleExt,
					'"><input class="left" name="MSG[]" type="checkbox" value="',
					thisIndexId,
					'"',
					isChecked,
					' onclick="javascript:this.focus();this.blur();" id="'
							+ thisIndexId + __this.__moduleExt + '"',
					' onblur="' + __this.__thisName + ".checkboxBlur('"
							+ thisIndexId + "');\"",
					"/>",
					'<b class="mail_close" style="float:left" id="dopre'
							+ __this.__moduleExt + '" title="'
							+ L("unfold preview") + '" onclick ="'
							+ __this.__thisName + '.previewMail(this)" name="'
							+ thisIndexId + '"></b>',
					__this.getLineStyle(thisData), "</td>" ];
			if (__this.listMailRowValue.from_digest == 1) {
				htmlList.push('<td title="', thisSender2,
						'"><a href="javascript:enjoy();" onclick="',
						__this.__thisName, ".readMail('", thisIndexId, "','",
						actionType, "', '", sortField, "',", thisIsRead,
						');">', thisSender, "</a></td>")
			}
			htmlList.push('<td style="padding-right:0px;"></td>');
			if (__this.listMailRowValue.subject_digest == 1
					|| __this.listMailRowValue.content_digest == 1) {
				htmlList.push('<td><a title="', thisSubject2,
						'" href="javascript:enjoy();" onclick="',
						__this.__thisName, ".readMail('", thisIndexId, "','",
						actionType, "', '", sortField, "',", thisIsRead,
						');">',
						__this.listMailRowValue.subject_digest != 1 ? ""
								: thisSubject2,
						'<span style="color:#aaaaaa;"> ',
						__this.listMailRowValue.content_digest != 1 ? ""
								: htmlSpecialChars(thisData.content_digest),
						"</span></a></td>")
			}
			htmlList.push("<td>" + thisAttach + "</td>");
			if (__this.listMailRowValue.folder == 1) {
				htmlList.push("<td>" + thisFolderName + "</td>")
			}
			if (__this.listMailRowValue.size == 1) {
				htmlList.push('<td><span class="f_L">',
						formatBytes(thisSize, 0), "</span></td>")
			}
			if (__this.listMailRowValue.index_time == 1) {
				htmlList.push('<td title="', toDate(
						L("year month day and hour"), thisMailTime), '">',
						formatDate(__this.now, thisMailTime), "</td>")
			}
			htmlList.push("</tr>")
		}
		if (typeof (file) === "string") {
			$("#mail_" + file + __this.__moduleExt).after(htmlList.join(""));
			$("#mail_" + file + __this.__moduleExt).remove()
		} else {
			$("#mail_" + file.id + __this.__moduleExt).after(htmlList.join(""));
			$("#mail_" + file.id + __this.__moduleExt).remove()
		}
	};
	this.onClose = function() {
		if (gSupportFlash && gUploadType == 2) {
			gUploadManager.destroySwfObj(__this.__moduleId)
		}
		if (__this.dragObject) {
			__this.dragObject.destroy()
		}
	};
	this.canClose = function() {
		if (__this.uploading) {
			if (!confirm(L("if continue, mail imported process will be paused. whether you want to continue?"))) {
				return false
			}
		}
		return true
	};
	this.onShow = function() {
		if (gSupportFlash && gUploadType == 2) {
			gUploadManager.displayDiv(__this.__moduleId, false)
		}
		if (g("last_read_" + __this.lastReadMailIndex)) {
			var oldPnode = g("last_read_" + __this.lastReadMailIndex).parentNode;
			oldPnode.removeChild(g("last_read_" + __this.lastReadMailIndex))
		}
		if (gLastReadMailIndex == gTopReadMailIndex) {
			__this.signLastReadMail("hasread_div_top_" + gLastReadMailIndex,
					gLastReadMailIndex, 1)
		} else {
			__this.signLastReadMail("hasread_div_" + gLastReadMailIndex,
					gLastReadMailIndex, 0)
		}
	};
	this.exportMail = function(isDown) {
		if (typeof (isDown) == "undefined") {
			isDown = "false"
		}
		isDown = !!isDown;
		var selMail = this.getSelMail();
		if (selMail == "") {
			gMessage.showMessageMain(L("please choose exporting mail"), "fail");
			return false
		}
		var indexArr = selMail.split(",");
		var maxNum = __this.userPackMail.num - 0;
		var disSize = __this.userPackMail.size - 0;
		var maxSize = disSize * 1024 * 1024;
		var curArr = __this.getCountByType();
		var curNum = curArr.count;
		var curSize = curArr.size;
		if (curNum > maxNum || curSize > maxSize) {
			gMessage.showMessageMain(sprintf(
					L("exporting mail maxsize is %s, maxnum is %s"), disSize,
					maxNum), "fail");
			return false
		}
		var url = gUrlPublicPrefix
				+ "?q=compose.output&action=mail.origin.compress&iid="
				+ selMail + "&zid=" + gZid;
		if (isDown) {
			url += "&method=down";
			download(url)
		} else {
			url += "&method=show";
			window.open(url)
		}
	};
	this.refreshListMail = function() {
		var uc = new UrlControl();
		gCc.cleanCache({
			q : "settings_web",
			uc : uc,
			type : "page"
		});
		gCc.cleanCache({
			q : "listmail",
			uc : uc,
			type : "page"
		});
		var page = (typeof (__this.page) <= 0 ? 1 : __this.page);
		__this.goPage(page)
	};
	this.markSpamMail = function(action) {
		var selMail = this.getSelMail();
		if (selMail === "") {
			gMessage.showMessageMain(
					L("please choose the email that you want to move"), "fail");
			return
		}
		function processError(errcode, errinfo) {
			if (action == "markspam") {
				gMessage.showMessageMain(L("mark spam email fail")
						+ gCheck.getRestrictMessage({
							type : "systemError"
						}), "fail")
			} else {
				gMessage.showMessageMain(L("unmark spam email fail")
						+ gCheck.getRestrictMessage({
							type : "systemError"
						}), "fail")
			}
		}
		$.ajax({
			url : gUrlPrefix + "?q=compose.del.do",
			data : "action=" + action + "&iid=" + selMail + "&fid="
					+ __this.folderId,
			dataType : "json",
			type : "POST",
			success : __this.afterDel,
			error : processError
		})
	}
};